This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients neologix, s7v7nislands
Date 2011-02-22.20:16:49
SpamBayes Score 2.74556e-09
Marked as misclassified No
Message-id <1298405811.01.0.840693729759.issue11284@psf.upfronthosting.co.za>
In-reply-to
Content
To elaborate on this, to my knowledge, there's no portable and reliable way to close all open file descriptors.
Even with the current code, it's still possible that some FD aren't properly closed, since getconf(SC_OPEN_MAX) often returns RLIMIT_NOFILE soft limit, which might have been lowered by the application after having opened a whole bunch of files.
Anyway, if the performance hit is too high, I think you only have two options:
- set your FD as CLOEXEC (note that it's already the case for FD used by popen and friends), and don't pass close_fds argument
- if you don't need many FD, you could explicitely set RLIMIT_NOFILE to a low value so that close_fds doesn't need to try too many FD, e.g.:
import resource
resource.setrlimit(resource.RLIMIT_NOFILE, (1024, 1024))
History
Date User Action Args
2011-02-22 20:16:51neologixsetrecipients: + neologix, s7v7nislands
2011-02-22 20:16:51neologixsetmessageid: <1298405811.01.0.840693729759.issue11284@psf.upfronthosting.co.za>
2011-02-22 20:16:49neologixlinkissue11284 messages
2011-02-22 20:16:49neologixcreate