[Python-bugs-list] [ python-Bugs-566037 ] Popen exectuion blocking w/threads

noreply@sourceforge.net noreply@sourceforge.net
Mon, 10 Jun 2002 12:39:40 -0700


Bugs item #566037, was opened at 2002-06-07 20:07
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=566037&group_id=5470

Category: Threads
Group: Python 2.2.1
Status: Open
Resolution: None
>Priority: 3
Submitted By: Martin Stoufer (mstoufer)
Assigned to: Nobody/Anonymous (nobody)
Summary: Popen exectuion blocking w/threads

Initial Comment:
The following unit test hangs after the first two lines
of output. This is wholly reproducible (for us) under
2.2.1 and totaly unreproducible under 2.1. We have both
interpreters installed on a RH7.2 PC with linkings
against the apparent same /lib/libthread.so.0

import os, threading,time, sys
def read_output(self, cmd, timeout):
        print "run: %s" % cmd
        (inf,outf) = os.popen4(cmd)
        print "started! out_fd=%d" % outf.fileno()
        while 1:
            line = outf.readline()
            if line == "": break
            print len(line),line
            sys.stdout.flush()
        return
if __name__ == '__main__': 
    thr =
threading.Thread(target=read_output,args=(1,"ping -c 5
www.mit.edu",0))
    thr.start()
    print "Started thread"
    while 1: time.sleep(1)

mstoufer@dpsslx05(3)>ldd /usr/local/bin/python2.{1,2}
/usr/local/bin/python2.1:
	libpthread.so.0 => /lib/libpthread.so.0 (0x40029000)
	libdl.so.2 => /lib/libdl.so.2 (0x40040000)
	libutil.so.1 => /lib/libutil.so.1 (0x40044000)
	libstdc++-libc6.1-2.so.3 =>
/usr/local/lib/libstdc++-libc6.1-2.so.3 (0x40047000)
	libm.so.6 => /lib/libm.so.6 (0x4008f000)
	libc.so.6 => /lib/libc.so.6 (0x400b1000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
/usr/local/bin/python2.2:
	libdl.so.2 => /lib/libdl.so.2 (0x40029000)
	libpthread.so.0 => /lib/libpthread.so.0 (0x4002d000)
	libutil.so.1 => /lib/libutil.so.1 (0x40044000)
	libm.so.6 => /lib/libm.so.6 (0x40047000)
	libc.so.6 => /lib/libc.so.6 (0x4006a000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-06-10 15:39

Message:
Logged In: YES 
user_id=6380

Mixing forks and threads is often asking for trouble...

Does this also hang with another command that produces more
than two lines of output, or is it limited to ping?

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-06-09 04:32

Message:
Logged In: YES 
user_id=21627

I can't reproduce this on a SuSE system, either (which has
glibc 2.2.5), so I'm tempted to declare it a glibc 2.1 bug.

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

Comment By: Mark Hammond (mhammond)
Date: 2002-06-08 01:42

Message:
Logged In: YES 
user_id=14198

Just noting that current CVS Python works fine on Windows,
but also hangs on RH7.  My Linux debuggings skills are such
that I can offer no further help ;)

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

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