[Python-bugs-list] [ python-Bugs-544473 ] Queue module can deadlock

noreply@sourceforge.net noreply@sourceforge.net
Mon, 15 Apr 2002 19:47:45 -0700


Bugs item #544473, was opened at 2002-04-15 22:09
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=544473&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Hammond (mhammond)
Assigned to: Mark Hammond (mhammond)
Summary: Queue module can deadlock

Initial Comment:
Prompted by a users experimentation where he was able
to show Pythonwin hanging, I have found a case where
the Queue module deadlocks.  It appears that if a
RuntimeError is generated while queueing data, the
queue lock will remain held.

Attaching a test script.  This hangs on Win2k and
Linux.  Win2k callstack shows Queue is waiting for the
following lock (line 53)

        if block:
            self.fsema.acquire()

Presumably (but untested at the moment), the previous
call to q.put(), which triggered a "RuntimeError:
maximum recursion depth exceeded", left the lock acquired.

It seems a few choice try/finally statements in the
Queue module would go along way :)  I will try and get
to this soon.



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

>Comment By: Tim Peters (tim_one)
Date: 2002-04-15 22:47

Message:
Logged In: YES 
user_id=31435

Yup, it hangs on Win98 too.  Nice job of whittling it down, 
Mark!  We've been looking for an excuse to make Queue 
slower too <wink>.

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

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