[issue1731717] race condition in subprocess module
Robert Siemer
report at bugs.python.org
Sat Mar 29 00:51:29 CET 2008
Robert Siemer <Robert.Siemer-python.org at backsla.sh> added the comment:
Bad design stays bad design: the hope that pids don't get reused soon
breaks two assumptions:
1) I don't have to wait() for a child process soon. It's the programs
business.
2) Pids cycle: there are security patches to make pids of future
processes hard to predict by assigning random free pids.
I actually was about to report a bug on subprocess when I bumped into
this one. My problem is pretty thread-less but related:
How do I kill() a process if it's pid got recycled behind my back??
In my opinion the module should work the "Python" way of doing things,
otherwise programmers will be surprised, as I was:
a) don't do my work (no wait() for things I care of/have reference to)
b) do your work (clean up things I don't care of/have no reference to)
If that's not possible, how does subprocess actually "intends to replace
os.spawn*"? [Library Reference]
It is still possible to extend the Popen() call to reflect if the caller
wants a P_NOWAITO or P_NOWAIT behavior, but the closer we get to the os,
the less sense does it make to replace some other modules...
----------
nosy: +siemer
_____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1731717>
_____________________________________
More information about the Python-bugs-list
mailing list