This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2.4 crashes when try to exit app and mulitple threads active
Type: crash Stage: test needed
Components: Interpreter Core Versions: Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: KeyError at exit after 'import threading' in other thread
View: 1596321
Assigned To: Nosy List: ajaksu2, amaury.forgeotdarc, facundobatista, hugendian, nadiasvertex
Priority: normal Keywords:

Created on 2005-03-08 23:14 by hugendian, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg60696 - (view) Author: hugendian (hugendian) Date: 2005-03-08 23:14
I am attaching the traceback of a python 2.4 crash.

The application I am developing executes many threads
and then has a "monitor" part that monitors certain
events. One event causes the application to shutdown.
On shutdown it notifies threads of a shutdown, and the
threads must cleanup and exit.

The traceback below occured on a shutdown. At the time
there was only one thread running.

I do not know how to investigate further. However given
pointers to do this I would be more than happy to
investigate and provide all information that could help
with this.

Some things I've observed:
1 - my application seems to be able to complete
successfully.
2 - it appears to be only after the app exits.
3 - it is not consistent. (too easy if it was!).
4 - more likely to occur the longer a
thread/application has run.
5 - does occur frequently enough to be a problem.

Once again let me know what other info I can provide,
or anything I can do to help.

Below is the traceback and some system/environment info.

Thanks.
---------------------------------------------------------------------------------
Error 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

Software environment:
-----------------------
*********************************************
***         SYSTEM INFORMATION            ***
***     (Tue Mar  8 17:38:34 EST 2005)    ***
*********************************************
   Machine type       : i686
   Operating system   : Linux
   Kernel version     : 2.4.29
   Linux Distribution : Slackware 10.1.0
*********************************************
Python   2.4 (#1, Jan  1 2005, 21:33:55) [GCC 3.3.4] on
linux2
Gnu make   3.80
util-linux   2.12p
modutils   2.4.27
e2fsprogs   tune2fs
Linux C Library   2.3.4
Dynamic linker (ldd)   2.3.4
Linux C++ Library   5.0.6
Procps   3.2.3
Net-tools  1.60
Kbd   1.12
Sh-utils 5.2.1
*********************************************
Modules Loaded:
	nfs
	lockd
	sunrpc
	ppp_deflate
	zlib_inflate
	zlib_deflate
	bsd_comp
	ppp_async
	ppp_generic
	slhc
	emu10k1
	ac97_codec
	soundcore
	xfs
	ne2k-pci
	8390
	crc32
*********************************************
gcc version 3.3.4
Reading specs from
/usr/lib/gcc-lib/i486-slackware-linux/3.3.4/specs
Configured with: ../gcc-3.3.4/configure --prefix=/usr
--enable-shared --enable-threads=posix
--enable-__cxa_atexit --disable-checking --with-gnu-ld
--verbose --target=i486-slackware-linux
--host=i486-slackware-linux
Thread model: posix
*********************************************
msg68540 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-06-21 20:45
Does this still happen with newer Python versions? Could you provide an
example code?

Thanks!
msg72390 - (view) Author: Christopher Nelson (nadiasvertex) Date: 2008-09-03 16:09
I also experience this on a regular basis.  I can't show you the code 
due to IP restrictions, but it happens almost 100% of the time in python 
2.4.4 on win2k8, and frequently in win2k3. 

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "C:\Program Files\Opsware\agent\lcpython15\lib\atexit.py", line 
24, in _r un_exitfuncs
    func(*targs, **kargs)
  File "C:\Program Files\Opsware\agent\lcpython15\lib\threading.py", 
line 638, i n __exitfunc
    self._Thread__delete()
  File "C:\Program Files\Opsware\agent\lcpython15\lib\threading.py", 
line 522, i n __delete
    del _active[_get_ident()]
KeyError: 2540
Error in sys.exitfunc:
Traceback (most recent call last):
  File "C:\Program Files\Opsware\agent\lcpython15\lib\atexit.py", line 
24, in _r un_exitfuncs
    func(*targs, **kargs)
  File "C:\Program Files\Opsware\agent\lcpython15\lib\threading.py", 
line 638, i n __exitfunc
    self._Thread__delete()
  File "C:\Program Files\Opsware\agent\lcpython15\lib\threading.py", 
line 522, i n __delete
    del _active[_get_ident()]
KeyError: 2540
msg82183 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-02-15 23:35
A sample script that reproduces this behavior in 2.6 is needed if this
one is to have a chance of being fixed.
msg82343 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-02-17 17:20
the issue1596321 is very similar (same traceback on another platform).
The problem is still valid, and the discussion seems more advanced there.
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41670
2009-02-17 17:20:49amaury.forgeotdarcsetsuperseder: KeyError at exit after 'import threading' in other thread
2009-02-17 17:20:32amaury.forgeotdarcsetstatus: open -> closed
resolution: duplicate
messages: + msg82343
nosy: + amaury.forgeotdarc
2009-02-15 23:35:56ajaksu2settype: crash
stage: test needed
messages: + msg82183
nosy: + ajaksu2
versions: + Python 2.6, - Python 2.4
2008-09-03 16:09:30nadiasvertexsetnosy: + nadiasvertex
messages: + msg72390
2008-06-21 20:45:57facundobatistasetnosy: + facundobatista
messages: + msg68540
2005-03-08 23:14:55hugendiancreate