[issue11284] slow close file descriptors in subprocess, popen2, os.popen*
Charles-Francois Natali
report at bugs.python.org
Wed Mar 2 20:54:52 CET 2011
Charles-Francois Natali <neologix at free.fr> added the comment:
> Your posix_closefrom() implementation as written today is not safe to call between fork() and exec() due to the opendir/readdir implementation. It can and will hang processes at unexpected times.
Yeah, I remove the patch when I realized that.
> According to http://www.unix.com/man-page/All/3c/closefrom/ closefrom() is not async-signal-safe. :(
Strange. I was sure closefrom was implemented with fcntl.
> I still want to find a way to do this nicely on Linux (even if it means me going and implementing a closefrom syscall to be added to 2.6.39).
Well, arguably, CLOEXEC is designed to cope with this kind of situation.
closefrom is more like a hack (and mostly useless if it's really not async-safe).
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11284>
_______________________________________
More information about the Python-bugs-list
mailing list