thread.error: release unlocked lock

John P. Speno speno at net.isc.upenn.edu
Thu Nov 18 19:46:11 CET 2004


So you have this problem, and you decide to use threads to solve it...

System is Python 2.3.3 on Solaris 9.

I'm using the classic Python thread model. Main thread puts stuff into
a Queue.Queue() and worker threads get stuff out of it and do their thing.

On occaision, I get an exception in the main thread when it tries to
put something into the Queue.

   File "/usr/local/bin/poller.py", line 47, in fragnap_it
     work_queue.put((foo, bar, baz))
   File "/usr/local/lib/python2.3/Queue.py", line 106, in put
     self.fsema.release()
   thread.error: release unlocked lock

Seems like a bad thing, and I'm not sure what can be done. Should I catch
the thread.error and retry the put()? Or just give up and shutdown nicely?
(Or quickly finish the twisted version of this code?)

Any idea on the underlying cause of this exception?

...and now you have (at least) two problems.

Thanks.



More information about the Python-list mailing list