Multithreaded python program freezes
Cameron Simpson
cs at zip.com.au
Sun Dec 20 23:59:31 EST 2009
On 20Dec2009 17:36, Andreas R�sdal <andrearo at pvv.ntnu.no> wrote:
| I have some problems with a http proxy which is implemented
| in Python 2.6. A few times a day, the proxy begins using 100% CPU
| and doesn't work any more.
|
| I have created a thread dump when the problem occurs here:
| http://www.pvv.ntnu.no/~andrearo/thread-dump.html
|
| This is a thread dump during normal operation:
| http://www.pvv.ntnu.no/~andrearo/thread-dump-normal.html
These two URLs don't work for me.
[...]
| Any advice on why this Python program appears to freeze? Is there anything
| more I can do to find out why this problem occurs?
Sounds like a livelock:
http://en.wikipedia.org/wiki/Deadlock#Livelock
or busy lock.
Can you find out which bits of your program are busy?
Are there places in your code that loop, polling for data, instead of
using blocking I/O. With a network proxy, a typical place that might
happen is a loop testing select() (or its poll-like friends) with a short or
zero timeout on inactive file handles.
Cheers,
--
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/
No electrons were harmed in the production of this message.
- Dr. P. Gensheimer <paulg at fs1.mpifr-bonn.mpg.de>
More information about the Python-list
mailing list