In Python Paste, there is a reloader module that uses os._exit from inside of a thread. This doesn't fail on anyone else's system. Attached is a minimal testcase showing that this happens. Steps to reproduce: 1. Run attached testcase 2. Testcase hangs 3. Requires an external kill to die What should happen: 1. Run attached testcase 2. Program exits Emerge Info: Gentoo Base System version 1.6.14 Portage 2.0.54 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r2, 2.6.15-gentoo-r1 i686) ================================================================= System uname: 2.6.15-gentoo-r1 i686 Intel(R) Pentium(R) M processor 1500MHz dev-lang/python: 2.3.5-r1, 2.4.2 sys-apps/sandbox: 1.2.12 sys-devel/autoconf: 2.13, 2.59-r6 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1 sys-devel/binutils: 2.16.1 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r2 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=i686 -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-O2 -march=i686 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig candy distlocks prelink sandbox sfperms strict" GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo" LINGUAS="en ja" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="x86 X aac aalib adns aim aimextras alsa apm audiofile avi bash-completion berkdb bitmap-fonts browserplugin bzip2 canvas cdr cjk crypt crypto cscope curl doc dvd dvdread effects emboss encode escreen ethereal exif expat fastcgi ffmpeg flac font-server foomaticdb gcj gd gdbm gif glitz glut gmp gnuplot gnutls gpm gstreamer gtk gtk2 gtkhtml idn imagemagick imap imlib inkjar jabber jpeg lcms ldap libcaca libg++ libwww lua mad menubar mikmod mng motif mozdevelop mozsvg mp3 mpeg nas ncurses nethack nls nodrm nowin nvidia offensive ogg oggvorbis openal opengl openssl oscar pam pcre pdflib perl png python quicktime quotes readline recode samba sdl slang spell sqlite ssl svg svga tabs tcltk tcpd tetex tiff truetype truetype-fonts type1-fonts udev unicode usb vim-with-x vorbis win32codecs wmf xine xinetd xml xml2 xv xvid yahoo zlib linguas_en linguas_ja userland_GNU kernel_linux elibc_glibc" Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS
Created attachment 78788 [details] Example testcase
On both my ~x86 and my x86 hardened box the test program exits immediately with exit status 3 (after changing os.exit to os._exit). So cannot reproduce. Wild guess: both systems have nptl in USE. If someone has a -nptl box around to test with: can you test if this is nptl-related?
Comment on attachment 78788 [details] Example testcase import os, threading def run(): os._exit(3) t = threading.Thread(target=run) t.start()
(In reply to comment #2) > On both my ~x86 and my x86 hardened box the test program exits immediately with > exit status 3 (after changing os.exit to os._exit). So cannot reproduce. Wild > guess: both systems have nptl in USE. If someone has a -nptl box around to test > with: can you test if this is nptl-related? My box was -nptl. I turned on nptl and nptlony and the testcase now passes as well as the program that was failing. Does this mean the bug should be moved to UPSTREAM?
Created attachment 78820 [details] This testcase is actually the one that fails
It does look like this is a bug, but I'm not sure if it's a python or a glibc bug. You said gentoo was the only os this happened on? Are the non-gentoo systems this works on using nptl or not (you should be able to run /lib/libc.so.6 and look for "Native POSIX Threads Library" in the output to find out)?
The only other person I knew who had the problem was also running Gentoo but he also compiles Python from source himself. After reemerging glibc with nptl and nptlonly, his issue was fixed as well. I'm going to resolve this bug and move it upstream as it seems like it is not a Gentoo issue.