Red Hat Bugzilla – Bug 136050
Dumb closing of file descriptors
Last modified: 2014-08-31 19:26:49 EDT
Description of problem:
On two occasions squid closes all file descriptors but the standard
three. This is done by iterating over all possible descriptor values
and calling close. There is a better way. Just image what the code
would do if the max fd count is 16k or more.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.strace starting squid
thousands of close() calls
normally none since there are no excess desriptors in use
I'll attach a patch.
Created attachment 105346 [details]
Replace dumb loops with something more intelligent
This works on all Linux systems. It's not portable but this is an OPP.
Upstream noticed that closing file descriptors that're being used by
various libraries (ssl, syslog, etc) can Be Bad. The squid I just
built into Rawhide includes a patch to correct its behavior.