[Python-bugs-list] [ python-Bugs-516372 ] test_thread: unhandled exc. in thread

noreply@sourceforge.net noreply@sourceforge.net
Fri, 15 Feb 2002 23:06:11 -0800


Bugs item #516372, was opened at 2002-02-12 02:30
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=516372&group_id=5470

>Category: Threads
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Armin Rigo (arigo)
>Assigned to: Tim Peters (tim_one)
Summary: test_thread: unhandled exc. in thread

Initial Comment:
test_thread.py occasionally dumps a "Unhandled 
exception in thread" traceback at the last thread 
line "mutex.release()" about NoneType not having a 
release attribute. The problem is confusing for users 
thinking that something went wrong with the test 
(althought the regrtest suite doesn't detect such 
exceptions and tells that the test passed --- this 
could be another bug report BTW).

The problem shows up with Psyco but could also appear 
on plain Python executions depending on the precise 
timing. It comes from the fact that the thread code 
ends with:

 ...
   done.release()
   mutex.release()

where these two are mutexes. The main program ends 
with:

 ...
   done.acquire()
   print "All tasks done"

so if 'done' is released, the main program may exit 
before the thread has a chance to release 'mutex', 
which happens to be a global variable that the Python 
module-unloading logic will replace with None.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2002-02-15 23:06

Message:
Logged In: YES 
user_id=31435

Changed Category to "Threads" and assigned to me.

----------------------------------------------------------------------

Comment By: Armin Rigo (arigo)
Date: 2002-02-14 11:37

Message:
Logged In: YES 
user_id=4771

The problem is not specific to Psyco, as it actually showed 
up once with Python only in test_threaded_import, which 
exhibits a similar behavior.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=516372&group_id=5470