[issue17969] multiprocessing crash on exit

Richard Oudkerk report at bugs.python.org
Mon May 13 16:41:11 CEST 2013


Richard Oudkerk added the comment:

> In general, deallocators should have no side effects, I think.  
> Releaseing the GIL is certainly a side effect.

Notice that socket and file objects also release the GIL when being deallocated.  At least for sockets close() can block (e.g. if you you use the SO_LINGER option).

I am not sure whether we can ignore the possibility for connection objects.

> I realize that process shutdown is a delicate matter.  One delicate 
> thing is that we cannot allow worker threads to run anymore.  I see no 
> general mechanism for ensuring this, but surely at least not releasing 
> the GIL for deallocators is a first step?

I agree that shutdown matters are delicate, particularly when daemon threads are involved.  In fact I'm starting to agree with Antoine that daemon threads are evil and should be avoided wherever possible.

P.S. I think in Python 3.x this thread switching is stopped (by setting _Py_Finalizing to something non-NULL) before PyInterpreterState_Clear() is run.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17969>
_______________________________________


More information about the Python-bugs-list mailing list