Issue4684
Created on 2008-12-17 17:59 by eggy, last changed 2022-04-11 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| foo.py | eggy, 2008-12-17 17:59 | test case | ||
| threading_exit_example.py | r.david.murray, 2009-08-27 00:59 | |||
| Messages (4) | |||
|---|---|---|---|
| msg77978 - (view) | Author: Mark Florisson (eggy) * | Date: 2008-12-17 17:59 | |
sys.exit() exits the program when non-daemonic threads are still running, in versions >= 2.5. Test included. A demonstration here: http://paste.pocoo.org/show/95766/ (On debian GNU/Linux) |
|||
| msg91985 - (view) | Author: Joseph Malicki (jmalicki) | Date: 2009-08-26 22:28 | |
It seems like this was introduced by the fix for Issue 1566280. Note that the threading module docs clear state: "A thread can be flagged as a “daemon thread”. The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. The flag can be set through the daemon property." This behavior violates it. The WaitForThreading() fix in Py_Main works only if sys.exit() is not called, which disagrees with the documentation. |
|||
| msg91991 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2009-08-27 00:59 | |
Attached is a version of your program that calls sys.exit from a thread other than the main one. That sys.exit does not cause python to shut down. Exiting the main program by "falling off the end" does not result in Python shutdown (pass an arbitrary argument to the example program to see this). So what we have here, I believe, is a documentation problem, and I've updated the issue to reflect that. Please note in particular the last two caveats in the 'thread' docs; I don't consider these adequate documentation, but they do seem to be relevant to the issue at hand. Does this make sense to you? Note that issue 6634 should also be addressed in any update to the relevant areas of the documentation. |
|||
| msg91993 - (view) | Author: Joseph Malicki (jmalicki) | Date: 2009-08-27 02:17 | |
Is it actually just documentation? Before Python 2.5, things worked according to the documentation, and nothing in the revisions that changed the behavior suggested this change in behavior was intentional. Moving the WaitForThreadShutdown() from Modules/main.c to Py_Finalize() would also fix this problem - I wonder why that wasn't the original change, as it more closely mirrors how Python 2.4 worked, and the documentation suggests? |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:42 | admin | set | github: 48934 |
| 2010-09-28 22:14:32 | twouters | set | status: open -> closed resolution: fixed superseder: Thread shutdown exception in Thread.notify() |
| 2009-08-27 02:17:32 | jmalicki | set | messages: + msg91993 |
| 2009-08-27 00:59:13 | r.david.murray | set | files:
+ threading_exit_example.py priority: normal components:
+ Documentation, - None messages:
+ msg91991 |
| 2009-08-26 22:28:53 | jmalicki | set | nosy:
+ jmalicki messages: + msg91985 |
| 2008-12-17 17:59:07 | eggy | create | |
