OSError: [Errno 12] Cannot allocate memory

Chris Angelico rosuav at gmail.com
Wed Nov 30 12:57:23 EST 2016


On Thu, Dec 1, 2016 at 4:34 AM, duncan smith <duncan at invalid.invalid> wrote:
>
> def _execute(command):
>     # shell=True security hazard?
>     p = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE,
>                          stdout=subprocess.PIPE,
>                          stderr=subprocess.STDOUT,
>                          close_fds=True)
>     output = p.stdout.read()
>     p.stdin.close()
>     p.stdout.close()
>     #p.communicate()
>     if output:
>         print output

Do you ever wait() these processes? If not, you might be leaving a
whole lot of zombies behind, which will eventually exhaust your
process table.

ChrisA



More information about the Python-list mailing list