Deadlock and a rather weird stacktrace

Vincent van Beveren V.vanBeveren at
Fri Feb 4 13:39:33 CET 2011

Hi everyone,

I'm currently working on a multithreaded GUI system in Python 2.6. In this system I use conditions to coordinate synchronization. However, one condition suddenly locks, without any cause. As a last resort I have written a small routine to dump all the stack traces. 

    def dumpAllStacks(self):
        for threadId, stack in sys._current_frames().items():
            print "Thread with Id: %s" % threadId

When the system is dead-locked, I invoke this method. One stack-trace strikes me as odd:

Thread with Id: 1568
  File "c:\PYTHON26\lib\", line 497, in __bootstrap
  File "c:\PYTHON26\lib\", line 525, in __bootstrap_inner
  File "c:\PYTHON26\lib\", line 477, in run
    self.__target(*self.__args, **self.__kwargs)
  File "c:\PYTHON26\lib\site-packages\magnum\gui\", line 2558, in __sendDataLoop
  File "c:\PYTHON26\lib\", line 256, in wait
  File "c:\PYTHON26\lib\", line 497, in __bootstrap
    self.__bootstrap_inner()		         <<===== What?
  File "c:\PYTHON26\lib\", line 525, in __bootstrap_inner
  File "c:\PYTHON26\lib\site-packages\magnum\subsys\", line 2242, in run
  File "c:\PYTHON26\lib\site-packages\magnum\subsys\", line 2214, in updateTask
  File "c:\PYTHON26\lib\site-packages\magnum\subsys\shared\", line 2450, in updateTaskWithConnection
    self.updateDataWithConnection(connection, updateAll)
  File "c:\PYTHON26\lib\site-packages\magnum\subsys\shared\", line 2488, in updateDataWithConnection
    self.updateVariableData(varDataDict, frozenset(varDataDict))
  File "c:\PYTHON26\lib\site-packages\magnum\subsys\shared\", line 796, in updateVariableData
    self.cmdMgr.updateVariableData(self.moduleId, varDataDict, forceVarIdSet) # after this varMgr makes deepcopy
  File "c:\PYTHON26\lib\site-packages\magnum\subsys\shared\", line 441, in updateVariableData
  File "c:\PYTHON26\lib\site-packages\magnum\subsys\shared\", line 493, in notifyUpdateReport
    with self.updateReportCondition:
  File "c:\PYTHON26\lib\", line 205, in __enter__
    return self.__lock.__enter__()
  File "c:\PYTHON26\lib\", line 121, in acquire
    rc = self.__block.acquire(blocking)

Can someone tell me how the sleep of one thread can continue as the 'run' of another? Is this normal? Thanks in advance!

Vincent van Beveren

Ing. V. van Beveren
Software Engineer, FOM Rijnhuizen
T: +31 (0) 30-6096769
E: V.vanBeveren at

More information about the Python-list mailing list