Patches item #1240614, was opened at 2005-07-19 02:25 Message generated for change (Comment added) made by aptshansen You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1240614&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Library (Lib) Group: Python 2.4 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dirk Groeneveld (marvinalone) Assigned to: Nobody/Anonymous (nobody) Summary: release lock on exception in threading.Thread.join() Initial Comment: If an exception happens in threading.Thread.join(), the lock self.__block never gets released. The next time Thread.join() is called, it blocks forever. The only exception I can think of right now that triggers this error is KeyboardInterrupt, but there might be more. The patch puts everything between self.__block.acquire() and self.__block.release() into a try ... finally block, and releases the lock in the finally clause. A transcript of the error follows: >>> import threading >>> def f(): ... while True: ... pass ... >>> t = threading.Thread(target = f) >>> t.setDaemon(True) >>> def j(t): ... while True: ... print "trying to join" ... t.join(1) ... >>> t.start() >>> j(t) trying to join trying to join trying to join <pressed ctrl+c here> Traceback (most recent call last): File "<stdin>", line 1, in ? File "<stdin>", line 4, in j File "/usr/lib/python2.4/threading.py", line 550, in join self.__block.wait(delay) File "/usr/lib/python2.4/threading.py", line 222, in wait _sleep(delay) KeyboardInterrupt >>> j(t) trying to join <python has to be killed after this line> ---------------------------------------------------------------------- Comment By: Stephen Hansen (aptshansen) Date: 2007-03-16 07:10 Message: Logged In: YES user_id=1720594 Originator: NO I peaked around; the patch that got applied to resolve this was 1314396 in r41524. ---------------------------------------------------------------------- Comment By: Stephen Hansen (aptshansen) Date: 2007-03-16 06:41 Message: Logged In: YES user_id=1720594 Originator: NO This is redundant in the current HEAD of the repository; there's already a try/finally with a release in it. Recommend close. ---------------------------------------------------------------------- Comment By: Dirk Groeneveld (marvinalone) Date: 2005-07-22 07:12 Message: Logged In: YES user_id=146647 The (a?) corresponding bug report is #1171023, at http://www.python.org/sf/1171023. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1240614&group_id=5470 _______________________________________________ Patches mailing list Patches@python.org http://mail.python.org/mailman/listinfo/patches