"Too many open files in system" error

From: Jonatan Evald Buus <jonatan(dot)buus(at)cellpointmobile(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: "Too many open files in system" error
Date: 2009-08-12 16:55:07
Message-ID: 113ce31b0908120955w77029099i7ececc053084095a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Greetings,
We're seeing numerous "LOG: out of file descriptors: Too many open files in
system; release and retry" entries as well as quite a few "LOG: could not
open temporary statistics file "global/pgstat.tmp": Too many open files in
system"
Much more alarming however, we're seeing errors such as:
FATAL: could not open file "global/pg_database": Too many open files in
system
ERROR: could not open relation 1663/2219053/2601: Too many open files in
system

kern.maxfiles is currently set to 12328 and "sysctl -a | grep
kern.openfiles" showed over 10.000 open files prior to a reboot.
After the reboot kern.openfiles quickly increased from less than 200 to over
4000 and appears to be ever increasing.
"lsof | grep postgres | wc -l" showed approximately 4400 just after reboot
but appears to be increasing at a steady pace (have increased to around 4800
in 30 min)

System is running FreeBSD 7.1 with 2GB RAM and have been running without
issues for over 6 months with PostGreSQL 8.3.6.
We upgraded to PostGreSQL 8.3.7 around a month ago, not sure if this is
related?
The server is a dedicated file server running PostGreSQL and Subversion.
Subversion has very few users so it shouldn't be an issue.

We've tried changing max_files_per_process to 500 from the default 1000 but
this doesn't appear to have had any effect.
Other changes from the default configuration include:
max_connections = 256
shared_buffers = 768MB
temp_buffers = 96MB
max_prepared_transactions = 50
work_mem = 48MB
maintenance_work_mem = 192MB
max_stack_depth = 8MB

Is it normal for PostGreSQL to have close to 5000 file handles open while
running?
Or is there some other circumstance which could cause file descriptors to
leak?

Appreciate any input

Cheers
Jona

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Emanuel Calvo Franco 2009-08-12 17:14:27 Re: "Too many open files in system" error
Previous Message Alvaro Herrera 2009-08-12 04:56:02 Re: XID wraparound in 8.4