The reliability of python threads

John Nagle nagle at animats.com
Tue Jan 30 13:06:51 EST 2007


Aahz wrote:
> In article <mailman.3166.1169752349.32031.python-list at python.org>,
> Carl J. Van Arsdall <cvanarsdall at mvista.com> wrote:
> My point is that an app that dies only once every few months under load
> is actually pretty damn stable!  That is not the kind of problem that
> you are likely to stimulate.

     This has all been so vague.  How does it die?

     It would be useful if Python detected obvious deadlock.  If all threads
are blocked on mutexes, you're stuck, and at that point, it's time
to abort and do tracebacks on all threads.   You shouldn't have to
run under a debugger to detect that.

     Then a timer, so that if the Global Python Lock
stays locked for more than N seconds, you get an abort and a traceback.
That way, if you get stuck in some C library, it gets noticed.

     Those would be some good basic facilities to have in thread support.

     In real-time work, you usually have a high-priority thread which
wakes up periodically and checks that a few flags have been set
indicating progress of the real time work, then clears the flags.
Throughout the real time code, flags are set indicating progress
for the checking thread to notice.  All serious real time systems
have some form of stall timer like that; there's often a stall
timer in hardware.

				John Nagle



More information about the Python-list mailing list