os.wait() losing child?

Jason Zheng Xin.Zheng at jpl.nasa.gov
Thu Jul 12 22:03:32 CEST 2007


Nick Craig-Wood wrote:
> Sure!
> 
> You could get rid of this by sleeping until a SIGCHLD arrived maybe.

Yah, I could also just dump Popen class and use fork(). But then what's 
the point of having an abstraction layer any more?

>>  This can still be a problem for applications that call wait in a
>>  dedicated thread, but the program can always ignore the processes
>>  it doesn't know anything about.
> 
> Ignoring them isn't good enough because it means that the bit of code
> which was waiting for that process to die with os.getpid() will never
> get called, causing a deadlock in that bit of code.
> 

Are you talking about something like os.waitpid(os.getpid())? If the 
process has completed and de-zombified by another os.wait() call, I 
thought it would just throw an exception; it won't cause a deadlock by 
hanging the process.

~Jason



More information about the Python-list mailing list