Charles-François Natali added the comment:

Unfortunately, there's not much we can do about it: if dlsym() fails - which is 
the case here either because read() fails with EBADF, or because the file 
descriptor now points to another stream (i.e. not libgcc), the libc aborts 
(here upon pthread_exit(), not PyThread_delete_key()):
""" must be installed for pthread_cancel to work

Program received signal SIGABRT, Aborted.
[Switching to Thread 0xb7b0eb70 (LWP 17152)]
0xb7fe1424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb7e4e941 in *__GI_raise (sig=6) at 
#2  0xb7e51d72 in *__GI_abort () at abort.c:92
#3  0xb7e8ae15 in __libc_message (do_abort=1, fmt=0xb7f606f5 "%s") at 
#4  0xb7e8af44 in *__GI___libc_fatal (message=0xb7fc75ec " must be 
installed for pthread_cancel to work\n") at 
#5  0xb7fc4ffa in pthread_cancel_init () at 
#6  0xb7fc509d in _Unwind_ForcedUnwind (exc=0xb7b0edc0, stop=0xb7fc2bf0 
<unwind_stop>, stop_argument=0xb7b0e454) at 
#7  0xb7fc2b98 in *__GI___pthread_unwind (buf=<optimized out>) at unwind.c:130
#8  0xb7fbcce0 in __do_cancel () at pthreadP.h:265
#9  __pthread_exit (value=0x0) at pthread_exit.c:30
#10 0x08132ced in PyThread_exit_thread () at Python/thread_pthread.h:266
#11 0x08137c37 in t_bootstrap (boot_raw=0x8318aa8) at 
#12 0xb7fbbc39 in start_thread (arg=0xb7b0eb70) at pthread_create.c:304
#13 0xb7ef978e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

So if you're unlucky and end up closing the FD referring to libgcc used by 
dlopen/dlsym, you're pretty much screwed, and there's no way around this.

Note that you specific problem (upon PyThread_delete_key()) doesn't occur for 
python 2.7 because it uses and ad-hoc TLS implementation, whereas Python 3 uses 
the platform native TLS.
But as noted above, you can very well get an abort on pthread_exit(), and in 
likely many other places (pretty much everywhere libgcc can be dlopen'ed).

Unfortunately, we can't do much against this, so I'm tempted to close this as 
"wont fix".

nosy: +neologix
stage:  -> committed/rejected
status: open -> pending

Python tracker <>
Python-bugs-list mailing list

Reply via email to