insufficient file descriptors on Mac OS X

insufficient file descriptors on Mac OS X

am 09.11.2007 15:05:05 von Maximilian Tyrtania

I am trying to start the server (8.2.3 on Mac OS X 10.4.10 (8R2218)
Kernel-Version:Darwin 8.10.1).

I have 3Gb Ram available.

My memory settings are:

Maximilian-Tyrtanias-Computer-2:~ maximiliantyrtania$ sysctl -a | grep shm
kern.exec: unknown type returned
kern.sysv.shmmax: 134217728
kern.sysv.shmmin: 1
kern.sysv.shmmni: 1024
kern.sysv.shmseg: 32
kern.sysv.shmall: 32768

In postgresql.conf:
..
..
..
max_connections = 240
..
..
shared_buffers = 4MB

All other values are still on their defaults.

But, alas...

Maximilian-Tyrtanias-Computer-2:/Users/maximiliantyrtania postgres$
/usr/local/bin/postgres -D /usr/local/pgsql/data/
<%2007-11-09 14:46:42 CETFATAL: 53000: insufficient file descriptors
available to start server process
<%2007-11-09 14:46:42 CETDETAIL: System allows 6, we need at least 20.
<%2007-11-09 14:46:42 CETLOCATION: set_max_safe_fds, fd.c:432

I sure there is some additional setting I have to adjust, but i'm not sure
which one.

Any pointers?

Maximilian Tyrtania




---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Re: insufficient file descriptors on Mac OS X

am 09.11.2007 17:55:44 von Tom Lane

Maximilian Tyrtania writes:
> <%2007-11-09 14:46:42 CETFATAL: 53000: insufficient file descriptors
> available to start server process

This is not a shared-memory problem.

On my Mac, ulimit -n seems to be 256 by default, and you've got
max_connections = 240 so nearly all of those will be eaten by
semaphores.

You could change the ulimit setting, back off max_connections,
or apply this patch:
http://archives.postgresql.org/pgsql-committers/2007-09/msg0 0399.php

BTW, if you're really hoping to have 240 connections, you're
gonna need to do something about ulimit -u too.

$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) 6144
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 256
pipe size (512 bytes, -p) 1
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 100
virtual memory (kbytes, -v) unlimited

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Re: insufficient file descriptors on Mac OS X

am 15.11.2007 09:51:53 von Maximilian Tyrtania

Hi,

> Maximilian Tyrtania writes:
>> <%2007-11-09 14:46:42 CETFATAL: 53000: insufficient file descriptors
>> available to start server process
>
> This is not a shared-memory problem.
>
> On my Mac, ulimit -n seems to be 256 by default, and you've got
> max_connections = 240 so nearly all of those will be eaten by
> semaphores.
>
> You could change the ulimit setting, back off max_connections,
> or apply this patch:
> http://archives.postgresql.org/pgsql-committers/2007-09/msg0 0399.php

Ah, okay. I think I'd like to change the ulimit -n setting (basically
because i am new to PG and feel uneasy about applying patches yet), but I
guess that would have to be done at boot time, right? Or at least before the
server starts (which is at boot time in my case).

> BTW, if you're really hoping to have 240 connections, you're
> gonna need to do something about ulimit -u too.

> max user processes (-u) 100

Okay, I managed to change that via sysctl.conf which now looks like this:

kern.sysv.shmmax=134217728
kern.sysv.shmmin=1
kern.sysv.shmmni=1024
kern.sysv.shmseg=32
kern.sysv.shmall=65536
kern.maxproc=512
kern.macprocperuid=512

Btw, the machine (Mac OS 10.4.10) accepts those settings now, i didn't need
to change /etc/rc.

Now ulimit -a is

Sputnik-Server:/ administrator$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) 6144
file size (blocks, -f) unlimited
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 256
pipe size (512 bytes, -p) 1
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 266
virtual memory (kbytes, -v) unlimited

So basically I managed to deal with the ulimit -u problem, but not yet with
the ulimit -n one. For the time being I lowered the max_connections to 200,
which allows me to start the server.
I wonder if there is a way to set the number of allowed open files via
sysctl.conf or if there is some other way to set that value at boot time
already.

Thanks a lot,

Maximilian Tyrtania




---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster