Argh! Python 2.2 + threading + sockets = trouble

Freddie freddie at madcowdisease.org
Sat Sep 14 13:44:58 EDT 2002


Sandy Norton wrote:
> A more precise description of your problem will often help others help
> you; more specifically, stating that an app 'just stops working' is
> not a great problem description.
> 
> Localize the problem and someone may be able to point you in the right
> direction.
> 
> cia,
> 
> Sandy

I would if I could, but I don't know HOW to localize the problem. If I 
put a 'print alive!' statement in the main cowbounce loop, it prints 
alive! for a while, but it will stop when a random client manges to 
connect to a server. Ctrl-C stops working, and the server stops spawning 
a new thread to handle an incoming connection. This is after the 
connect() call in BounceClient succeeds. Other times, runnings threads 
(already connected to a server) will just stop passing data back and 
forth. The Python profiler is useless in a threaded application, and 
Linux doesn't have ktrace.

MadCowOffer starts a thread for each 'task'. IRC, database, transfer 
queues, admin interface, etc. If I unroll the map(lambda x: x.start(), 
self.__Threads) loop, it goes something like this:

Starting PackMan
Starting HeadHoncho
Starting Chatterbox

Then it becomes unresponsive. Ctrl-C won't kill the process, I have to 
terminate it with kill. The problem is, the exact same code runs 
PERFECTLY FINE in Python 2.1.x. This is what has me stumped :(

If you need any more info, feel free to contact me.

Freddie




More information about the Python-list mailing list