[Python-Dev] Sporadic failures of test_subprocess and test_multiprocessing_spawn

Victor Stinner victor.stinner at gmail.com
Mon Mar 30 02:26:07 CEST 2015


Hi,

2015-03-28 12:26 GMT+01:00 Chris Angelico <rosuav at gmail.com>:
> It seems to be stalling out. I'm not sure exactly what's happening
> here. Running just that one file doesn't do it, but running the full
> test suite results in a stall.

Ok, I reproduced the issue on David's buildbot. A (child) process was
stuck in _Py_open(), function called from _close_open_fds_safe() which
is called to run a child process.

Calling _Py_open() is not safe here because the GIL may or may not be
held. After fork, the status of the GIL is unclear.

I fixed the issue by replacing _Py_open() with _Py_open_noraise(),
this version doesn't use the GIL (it doesn't release the GIL to call
open() and it doesn't raise an exception).
https://hg.python.org/cpython/rev/2e1234208bab

Thanks David for the buildbot.

Victor


More information about the Python-Dev mailing list