vfork hangs

Jason Orendorff jason at jorendorff.com
Fri Mar 8 12:40:30 EST 2002


Kip Macy wrote:
> I'm having problems with my python application hanging in vfork with
> the child never completing the exec. It is hard for me to track it
> down just by putting a break on vfork because the code is
> multi-threaded, several thousand lines long, and doesn't hit this
> right away. I saw it suggested that system is not thread safe on
> solaris (the platform I'm using). The other thing of note is that a
> SIGCLD is always received promptly before the vfork hang.

According to the man page, system() is not thread-safe on Solaris.
It says, "MT-Level: Unsafe".  The vfork(2) man page says, "The vfork()
function is unsafe in multithreaded applications."

Not sure what makes it unsafe, but I wouldn't spend any more time
fighting it.

I believe a thread-safe system() can be implemented in Python, at the
cost of some performance.  If you go this way, I think you'll want to
use os.fork1() instead of os.fork().

Let us know how this works out for you.

## Jason Orendorff    http://www.jorendorff.com/




More information about the Python-list mailing list