Help with thread related tracebacks

Discussion in 'Python' started by Maxwell Hammer, Jun 16, 2005.

  1. 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
     
    Maxwell Hammer, Jun 16, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Mike_M=FCller?=

    tracebacks in embedded python

    =?ISO-8859-1?Q?Mike_M=FCller?=, Jul 9, 2003, in forum: Python
    Replies:
    1
    Views:
    337
    Thomas Heller
    Jul 9, 2003
  2. Maxwell Hammer
    Replies:
    7
    Views:
    654
    Peter Hansen
    Jun 18, 2005
  3. Michael P. Soulier

    getting tracebacks from traceback objects

    Michael P. Soulier, Jun 24, 2005, in forum: Python
    Replies:
    1
    Views:
    381
    Kent Johnson
    Jun 24, 2005
  4. Rustom Mody
    Replies:
    0
    Views:
    64
    Rustom Mody
    Jan 3, 2014
  5. Chris Angelico
    Replies:
    0
    Views:
    133
    Chris Angelico
    Jan 3, 2014
Loading...

Share This Page