[issue18966] Threads within multiprocessing Process terminate early

Tim Peters report at bugs.python.org
Thu Jul 14 14:46:35 EDT 2016


Tim Peters added the comment:

About:  "The notion of categorically refusing to let a process end perhaps overreaches in certain situations."  threading.py addressed that all along:  if the programmer _wants_ the process to exit without waiting for a particular threading.Thread, that's fine, they ask the Thread constructor for a "daemon" thread.  Whether a threading.Thread does or doesn't prevent process exit before it's .join()'ed has always been the programmer's choice.  Python never attempted to guess their intent (except for "the main thread", which is necessarily non-daemonic).  That's why it's especially surprising that multiprocessing can silently overrule what had always been an explicit choice about process-exit threading.Thread behavior.

About compatibility, yup, that's potentially painful.  I will note that compability was already broken on Windows with no apparent angst, or subsequent complaints (the program in issue 27508 is an example:  "runs forever" under 3.5.2 but "ends very quickly" under 2.7.11; "runs forever" is what the programmer wanted, matching how they expected non-daemon threading.Threads to work).

----------

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


More information about the Python-bugs-list mailing list