This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: popen with threads
Type: Stage:
Components: Interpreter Core Versions:
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: twouters Nosy List: tim.peters, twouters
Priority: normal Keywords:

Created on 2001-03-22 21:46 by anonymous, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (4)
msg4013 - (view) Author: Nobody/Anonymous (nobody) Date: 2001-03-22 21:46
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.


msg4014 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-04-05 02:33
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).
msg4015 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2001-04-05 21:34
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. 
msg4016 - (view) Author: Thomas Wouters (twouters) * (Python committer) Date: 2001-05-28 13:30
Logged In: YES 
user_id=34209

It's been long enough... Closing this bug with 'works for
me', since that's what it does.
History
Date User Action Args
2022-04-10 16:03:53adminsetgithub: 34218
2001-03-22 21:46:38anonymouscreate