2.4 crashes when try to exit app and mulitple threads active

Peter Hansen peter at engcorp.com
Sat Mar 19 22:35:39 EST 2005


Maxwell Hammer wrote:
> An application I am developing executes many threads and then has a
> "monitor" part that waits for certain events. One of these events causes
> the application to have to shutdown. On shutdown the monitor part
> notifies the threads of a shutdown, and the threads must cleanup and exit.
> When all threads have exited the monitor itself exits.
> 
> The traceback below occured on a shutdown. At the time there was only one
> thread running, however the same traceback occurs with many threads active.

When you say "only one thread running", did you mean only
one monitor thread in addition to the main thread, or did
you really mean only the main thread was active at this time?

Also, are you doing something odd to terminate threads
here, and could you have screwed things up yourself?
The code in question is at the end of the MainThread's
__exitfunc() method, and normally this would be executing
only after all other threads had terminated, and should
be safe.  It appears as though the _active dictionary that
tracks threads has been modified by someone else.

Can you post a small self-contained example that
reproduces the problem?

-Peter




More information about the Python-list mailing list