Python subprocess.Popen erroring with OSError: [Errno 12] Cannot allocate memory after period of time

前端 未结 9 1644
南方客
南方客 2020-12-06 01:53

Note: This question has been re-asked with a summary of all debugging attempts here.


I have a Python script that is running as a background pr

9条回答
  •  鱼传尺愫
    2020-12-06 02:55

    That swap space answer is bogus. Historically Unix systems wanted swap space available like that, but they don't work that way anymore (and Linux never worked that way). You're not even close to running out of memory, so that's not likely the actual problem - you're running out of some other limited resource.

    Given where the error is occuring (_get_handles calls os.pipe() to create pipes to the child), the only real problem you could be running into is not enough free file descriptors. I would instead look for unclosed files (lsof -p on the PID of the process doing the popen). If your program really needs to keep a lot of files open at one time, then increase the user limit and/or the system limit for open file descriptors.

提交回复
热议问题