Jenny Zhang <jenny@osdl.org> writes:
> And I still have the same problem. Since PG should fail if no more
> files can be opened, my test should fail. But I got all the other
> results back at the end of the run.
No, you miss my point. Usually PG will *not* fail when it hits ENFILE.
The code is designed to close other open files until it can successfully
open the required file. Only a freshly-started backend (with no pool of
already-open files) is likely to report any actual failure from ENFILE.
So a database under load can run quite happily when there are zero free
file table slots in the kernel --- but everything else in the system is
likely to show random failures.
regards, tom lane