Note that there are some explanatory texts on larger screens.

plurals
  1. POPython subprocess running out of file descriptors
    primarykey
    data
    text
    <p>I've got a long running python project that uses the subprocess module to start various other programs. It waits for each program to finish, then ends the wrapper function and returns to its wait loop.</p> <p>Eventually, this brings the computer it's running on to a grinding halt, with the error that there is no more file descriptors available. </p> <p>I'm not able to find anywhere in the <a href="http://docs.python.org/library/subprocess.html#subprocess.Popen" rel="nofollow">subprocess docs</a> what happens to file descriptors when a child process closes. At first, I thought they would close automatically, since the subprocess.call() command waits until the child terminates.</p> <p>But if that were the case I wouldn't have a problem. I also thought that if there was anything left over, python would garbage collect it when the function finishes, and the file descriptors go out of scope. But this doesn't seem to be the case either. </p> <p>How would I get access to these file descriptors? the subprocess.call() function only returns the exit code, not open file descriptors. Is there something else I'm missing here?</p> <p>This project acts as glue between various enterprise apps. Said apps cannot be pipelined, and they are gui systems. So, the only thing I can do is start them off with their built in macros. These macros output text files, which I use for the next program in the pipe.</p> <p>Yes, it is as bad as it sounds. Luckily, All the files end up having pretty unique names. So, here in the next few days I'll be using the sys internals tool suggested below to try and track down the file. I'll let you know how it turns out.</p> <p>Most of the files I don't open, I just move them with the win32file.CopyFile() function.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload