Debug Infinite Loop?

Stuart D. Gathman stuart at bmsi.com
Thu Apr 22 10:24:09 EDT 2004


I have a multi-threaded background program in Python
(http://www.bmsi.com/python/milter.html).  Rarely, several threads will
get themselves into an infinite loop.  The system continues to run - but
with more and more of the CPU eaten by the looping threads.  stderr is
connected to a logfile, and exceptions print stack traces to the logfile -
so debugging them is easy.  However, I haven't been able to find a way to
cause a looping thread to terminate with a stack trace.  I am on RedHat
7.2.  Sending SIGINT to the looping thread doesn't do anything.  The
situation may be complicated by the fact that the application uses
libmilter - a C library which does signal handling in its own C thread
(initiating an orderly shutdown on SIGTERM).  This may be interfering
with reception on SIGINT by python threads.

I am looking for the best way to get a stack trace from a looping
Python background thread.

-- 
	      Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.




More information about the Python-list mailing list