thread/queue bug

Peter Hansen peter at
Fri Dec 10 19:43:48 CET 2004

phil wrote:
> I have a very strange bug.  A thread in a .pyc stops dead.
> This program has many threads and queues and has worked
> great for months.
> One thread listens for UDP messages from other programs,
> and puts the messages in listenq.
> Procmsgs gets from listenq and for a certain kind of
> message creates another mq = Queue(0).
> I don't wish to distribute the source to
> so I have a short program import it, that is
> pnetx.pyc.
> Then the procmsgs thread dies at the Queue statement.
> But if I run as the main program, all works fine.
> So if or .pyc is imported this thread dies. ???
> I've tried this with 2.3.3 and 2.3.4.  Anyone?

A few random thoughts:

1. You haven't provided nearly enough info for anyone
to be able to help much, I suspect.

2. Threading problems can be incredibly complex and race
conditions are frequently next to impossible to troubleshoot,
let alone reproduce reliably.

3. Distributing a .pyc does very little to prevent someone
from getting your source, since it is possible to "decompile"
.pyc files into something fairly closely resembling the
original source.

4. The fact that you have a .pyc file instead of a .py
file very likely has *nothing* to do with any threading
problem you are facing, so I suggest you get past that mental
block and look elsewhere.

5. Sorry I can't be more help.  You don't give anyone much
to go on.  All that stuff about "Queue(0)" and "listenq"
is pretty much meaningless to us, you know...


More information about the Python-list mailing list