Dear all,
recently we have seen a lot of occurrences of "out of file descriptors: Too 
many open files; release and retry" in our postgres log files, every night when 
a "vacuum full analyze" is run. After some digging into the code we found that 
postgres potentially tries to open as many as a pre-determined maximum number 
of file descriptors when vacuuming. That number is the lesser of the one from 
the configuration file (max_files_per_process) and the one determined at 
start-up by "src/backend/storage/file/fd.c::count_usable_fds()". Under Solaris 
now, it would seem, finding out that number via dup(0) is not sufficient, as 
the actual number of interest might be/is the number of usable stream file 
descriptors (up until Solaris 10, at least). Also, closing the last recently 
used file descriptor might therefore not solve a temporary problem (as 
something below 256 is needed). Now, this can be fixed by setting/leaving the 
descriptor limit at 256 or changing the postgresql.conf setting accordingly. 
Still, the function for determining the max number is not working as intended 
under Solaris, it would appear. One might try using fopen() instead of dup() or 
have a different handling for stream and normal file descriptors (including 
moving standard file descriptors to above 255 to leave room for stream ones). 
Maybe though, all this is not worth the  effort; then it might perhaps be a 
good idea to mention the limitations/specialties in the platform specific notes 
(e.g. have u/limit at 256 maximum).

cheers
hardy


Hartmut Raschick
Network Management Solutions
-----------------------------------
KEYMILE GmbH
Wohlenbergstr. 3
D-30175 Hannover, Germany

Phone: +49 (0)511 6747-564
Fax:   +49 (0)511 6747-777
mailto:hartmut.rasch...@keymile.com
http://www.keymile.com

<< KEYMILE - because connectivity matters >>

Geschäftsführer/Managing Directors: Björn Claaßen, Michael Breyer, Axel Föry - 
Rechtsform der Gesellschaft/Legal structure: GmbH, Sitz/Registered office: 
Hannover HRB 61069, Amtsgericht/Local court Hannover, USt-Id. Nr./VAT-Reg.-No.: 
DE 812282795, WEEE-Reg.-No.: DE 59336750

Reply via email to