Help with thread related tracebacks

M

Maxwell Hammer

Hope someone can help with a problem I'm having.
A python program I wrote terminates with the following traceback.

*** start traceback ***
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.4/atexit.py", line 22, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.4/threading.py", line 636, in __exitfunc
self._Thread__delete()
File "/usr/lib/python2.4/threading.py", line 522, in __delete
del _active[_get_ident()]
KeyError: 16384
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.4/atexit.py", line 22, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.4/threading.py", line 636, in __exitfunc
self._Thread__delete()
File "/usr/lib/python2.4/threading.py", line 522, in __delete
del _active[_get_ident()]
KeyError: 16384
*** end traceback ***

The program works correctly, and the traceback occurs ONLY after my
program has exited normally.

I really don't know what causes this, and since the
program is quite large I wouldn't know what code snippet to post (if any).

The following pseudocode describes what my program does:

Main thread starts
does some processing...
while...
does some processing...
loads a function from a module known only at runtime by doing:
exec 'import %s as Plugin' % PluginImportPath
exec 'PluginStartFunction=getattr(Plugin, \'%s\')' % FunctionName
PluginStartFunction(job commands...)
monitor_events()
if we have to quit:
signal threads to complete and exit.
wait for threads to indicate complete
exit
# end while


Plugin Module:
PluginStartFunction(job commands...):
does some processing...
run the module's "run" function by doing:
thread.start_new_thread(PluginRunFunction, (job commands...))
return

PluginRunFunction(job commands...):
does some processing...
spawns an external unix (console) program by doing:
RETURN=os.system(program string...)
does some processing...
return
##end Plugin Module

I have to load the plugin functions using "exec" because the plugin modules are
only known at runtime, so cannot be hard-coded.

In any case, I have made sure that the main thread does wait for all other
threads to have terminated before it calls sys.exit and exits.
It is only after main thread has exited that the above traceback occurs.

Any gurus out there that can aid with this?

Any and all help would be appreciated, even guidance as to what to investigate
or to try.

By the way what graphical debuggers do people use for debugging python apps.?

Thanks very much
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top