This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jnoller
Recipients asksol, gdb, jnoller
Date 2010-07-12.21:03:56
SpamBayes Score 0.02920633
Marked as misclassified No
Message-id <1278968639.69.0.177194012404.issue9205@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2010-07-12 21:04:00jnollersetrecipients: + jnoller, asksol, gdb
2010-07-12 21:03:59jnollersetmessageid: <1278968639.69.0.177194012404.issue9205@psf.upfronthosting.co.za>
2010-07-12 21:03:57jnollerlinkissue9205 messages
2010-07-12 21:03:56jnollercreate