[Python-bugs-list] [ python-Bugs-410608 ] popen with threads

noreply@sourceforge.net noreply@sourceforge.net
Thu, 05 Apr 2001 14:34:04 -0700


Bugs item #410608, was updated on 2001-03-22 13:46
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=410608&group_id=5470

Category: Threads
Group: None
Status: Open
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Thomas Wouters (twouters)
Summary: popen with threads

Initial Comment:
This code generate a error

##########################
import threading
import os

class TestPopen( threading.Thread ):

   def run( self ):
      while 1:
         f = os.popen( "ls -l /" )
         lines = f.read()
         f.close()

if __name__ == "__main__":
   for i in range(50):
      t = TestPopen()
      t.start()
###########################

it eventually dies w/ IOErrors in the f.close() calls.

My system is:
Linux RedHat 6.2
Python 1.5.2
I tested in Python 2.0 and the same error occur.




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

>Comment By: Thomas Wouters (twouters)
Date: 2001-04-05 14:34

Message:
Logged In: YES 
user_id=34209

I cannot reproduce this with 2.1-CVS, but I am not able to
test this on RedHat 6.2 right now. It could be a limits
problem. If the original submittor is reading this: try
doing an 'unlimit' or 'ulimit -a' before running the script.
If it still crashes, please paste one of the tracebacks. I
do get IOErrors and some weird crashes when I run the above
script with lower filedescriptor limits, but not on the
f.close() call. 


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

Comment By: Tim Peters (tim_one)
Date: 2001-04-04 19:33

Message:
Logged In: YES 
user_id=31435

Thomas, you want to play with this on Linux?  I already 
gave my best guesses on c.l.py; there's no hope running 
popen stress tests on Win9x, as whether even one popen 
works there one time is a crapshoot.  I assume Mr./Ms. 
Anonymous is running out of system resources, but even if 
so that leaves the question of whether that's 1.5.2's or 
Linux's fault (if it works under current CVS, we can assume 
it was 1.5.2's fault).

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

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