<div dir="ltr">Hello,<div>I'm having some sort of 'problem' when using subprocess calls.</div><div>This is the code snipet that i am using:</div><div><div><br></div><div>capture_server1 = '''xvfb-run --auto-servernum ... '''       </div>
<div>server1_download = subprocess.Popen(shlex.split(capture_server1),stdin=subprocess.PIPE,</div><div>stdout=subprocess.PIPE,</div><div>stderr=subprocess.PIPE)</div><div>        </div><div>out_s1, err_s1 = server1_download.communicate()</div>
<div><br></div><div>time.sleep(2)</div><div><br></div><div>capture_server2 = '''xvfb-run --auto-servernum .... '''</div><div>server2_download = subprocess.Popen(shlex.split(capture_server2),</div><div>
stdin=subprocess.PIPE,</div><div>stdout=subprocess.PIPE,</div><div> stderr=subprocess.PIPE)</div><div><br></div><div>out_s2, err_s2 = server2_download.communicate()</div></div><div><br></div><div>The problem is the following:</div>
<div>- The program runs in a loop, where subprocess is called</div><div>- It runs for X days, sometimes 3 days, sometimes 5 days</div><div>- After that i get the following exception:</div><div><div><br></div><div>File "/usr/lib/python2.7/subprocess.py", line 1091, in pipe_cloexec</div>
<div>r, w = os.pipe()</div><div>OSError: [Errno 24] Too many open files</div></div><div><br></div><div><br></div><div>How can i reproduce this on a local machine, and how to make sure that i wont have any errors like this?</div>
<div><br></div><div>P.S. Version 2.7 is used with this program</div><div><br></div></div>