[Python-bugs-list] [ python-Bugs-426735 ] [Linux] Threaded Python program hangs

noreply@sourceforge.net noreply@sourceforge.net
Mon, 28 May 2001 18:47:37 -0700


Bugs item #426735, was updated on 2001-05-23 12:56
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=426735&group_id=5470

>Category: Python Interpreter Core
>Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Jeff Epler (jepler)
Assigned to: Nobody/Anonymous (nobody)
>Summary: [Linux] Threaded Python program hangs

Initial Comment:
import thread, os, time
thread.start_new_thread(os._exit, (1,))
time.sleep(1)
print "done"

The program never prints "done".

Python 2.1 (tummy RPM 2.1-4)
RedHat 6.2

strace of the main thread shows:
select(0, NULL, NULL, NULL, {1, 0})     = 0 (Timeout)
rt_sigprocmask(SIG_SETMASK, NULL, [RT_0], 8) = 0
rt_sigsuspend([]
... Python completes the time.sleep() call, and then
hangs waiting something.

----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-05-28 18:47

Message:
Logged In: YES 
user_id=31435

Changed to platform-specific, since it Works For Me on 
Win98SE.  However, I'm not sure what "works" means:  what 
do the Linux docs say _exit should do when called from a 
spawned thread?  Does this program fail the same way if you 
write it in C?  It may have to do with that Python 
implements time.sleep() on Linux via select(), to get fine
(r)-grained resolution.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=426735&group_id=5470