msg75149 - (view) |
Author: Guilherme Polo (gpolo) *  |
Date: 2008-10-23 20:28 |
Lib/threading.py gets into infinite recursion while testing (or using) it with verbose set. This didn't happen before because Thread.__started didn't use to be an Event, but now it is. Typical situation: _DummyThread calls _Thread__started.set, which calls __started.__cond.notify_all(), which calls __cond.notify(). If there are no waiters, it calls _Verbose._note, which calls currentThread, but if there is no current thread _DummyThread is called, which calls _Thread__started.set ... |
|
|
msg112131 - (view) |
Author: Mark Lawrence (BreamoreBoy) * |
Date: 2010-07-31 11:18 |
Could someone with knowledge of threading provide a unit test for this, assuming that you want or need to force threading into infinite recursion. Then we can test a patch that only moves two lines. |
|
|
msg112136 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-07-31 11:34 |
The patch looks ok. A more robust solution would be to modify _note() so that it never creates a DummyThread, and instead uses the raw thread id if the current thread doesn't have a corresponding Thread object. |
|
|
msg112139 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-07-31 11:38 |
I spoke too fast. With the patch, test_3_join_in_forked_from_thread in test_threading still fails with _VERBOSE manually set to True. |
|
|
msg112145 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-07-31 11:51 |
Here is a patch with the alternative approach suggested above. There still is the aforementioned test_threading issue when run standalone. |
|
|
msg124232 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2010-12-17 17:24 |
I can confirm that the patch fixes the recursion problem if threading._VERBOSE is set to true, but the test Antoine mentioned hangs when the test suite is run. _VERBOSE is an internal, undocumented facility, so perhaps the priority on this isn't really "high". On the other hand, Antoine's patch takes things from non-functional to at least partially functional, so perhaps it is worth applying as is, pending someone figuring out where the test hang is coming from. I looked in to this briefly, but I have no clue how to trigger this in a unit test, since it seems to happen when regrtest imports logging which imports threading, and appears to my threading-ignorant eyes to be tied to conditions that only exist at initial module import. |
|
|
msg124235 - (view) |
Author: Antoine Pitrou (pitrou) *  |
Date: 2010-12-17 17:46 |
Ok, I committed the patch in r87341 (3.2), r87342 (3.1) and r87343 (2.7). |
|
|
msg125284 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2011-01-04 02:26 |
The hanging test still hangs for me with _VERBOSE set to True on py3k trunk. |
|
|
msg125286 - (view) |
Author: Gregory P. Smith (gregory.p.smith) *  |
Date: 2011-01-04 02:42 |
sorry, i saw the patches committed and thought that had fixed it. oops. still more to be done. |
|
|
msg210321 - (view) |
Author: Berker Peksag (berker.peksag) *  |
Date: 2014-02-05 14:52 |
The threading._VERBOSE attribute was removed in issue 13550 (see also changeset http://hg.python.org/cpython/rev/8ec51b2e57c2). |
|
|