$ python tbq.py each test group is testing 1000 items sem_init: Resource temporarily unavailable Exception in thread Thread-4: Traceback (most recent call last): File "/tmp/python.572/usr/lib/python2.4/threading.py", line 442, in __bootstrap self.run() File "/tmp/python.572/usr/lib/python2.4/threading.py", line 422, in run self.__target(*self.__args, **self.__kwargs) File "tbq.py", line 10, in reader msg = Q.get() File "/tmp/python.572/usr/lib/python2.4/Queue.py", line 119, in get self.not_empty.wait() File "/tmp/python.572/usr/lib/python2.4/threading.py", line 197, in wait waiter = _allocate_lock() error: can't allocate lock
<process has to be killed from the Windows Task Manager, keyboard kill commands are ineffective.> tbq.py is: from Queue import Queue from threading import Thread def writer( Q, values ): for i in values: Q.put( i ) def reader( Q, values ): for i in values: msg = Q.get() assert msg == i def test_session( Qsize, msgs ): q1 = Queue( Qsize ) w = Thread( target=writer, args=( q1, msgs ) ) w.start() r = Thread( target=reader, args=( q1, msgs ) ) r.start() msgs = range(1000) print "each test group is testing %d items" % len( msgs ) test_session( 2, msgs ) test_session( 2, msgs ) cygcheck.out is attached. I had to play with the number of items being queued/enqueued in order to get the bug to reliably happen on my machine. The queue size, number of threads, and number of items being processed all affect whether or not this bug will manifest itself, which leads me to believe that the bug is a threading-timing issue that is probably highly specific to how Python is handling threads and locking resources. But that is just a guess, of course. Since all my attempts to simplify it further also fail to reproduce the bug, I think it is time to build my own debugging version of Python and see what I can learn from the inside, but that won't happen (vacations, etc.) for a few weeks. --Doug
cygcheck.out
Description: Binary data
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/