Jesse Noller <jnol...@gmail.com> added the comment:

Greg - I asked Ask to take a look - his celery package is a huge consumer of 
multiprocessing, and so I tend to run things past him as well. 

That said - to both of you - the fundamental problem the shutdown patch is 
trying to scratch is located in issue 9207 - greg's termination patch just 
exposes the problem in 9207 a lot more.

Focusing specifically on the shutdown patch; our issue is that during 
interpreter shutdown, sys.modules is iterated, and entries are set to None - 
for threads which "live on" well into that cycle can end up losing imported 
functions/modules/etc. The multiple daemon threads in the Pool code are 
exposing this as code which executed imported functions (such as the debug() 
statement in handle_workers) which will fire after the pool has exited and the 
interpreter is shut down.

We can work around the shutdown issue (really, bug 9207) by ignoring the 
exception such as shutdown.patch does, or passing in references/adding 
references to the functions those methods need. Or (as Brett suggested) 
converting them to class methods and adding references to the class. Or passing 
them in via the signature like this _handle_workers(arg, _debug=debug), etc.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9205>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to