Closed
Description
by jessevdk:
I was working with spawning a lot of processes that didn't exist from a number of goroutines. For these processes I was opening pipes for stdin, stdout and stderr. After some point my process always got errors like "pipe: too many open files". I quickly went through the sources and it seems that when LookupPath fails, and cmd.Start is called, the open ends of the pipes associated to the command are not closed at that time. Initially I found it hard to reproduce the bug because when the GC gets time to run, it will call the finalizers of the open files which end up closing the pipes. However, with enough go routines running at the same time (which I had in my original program) the problem can be reproduced quite easily. I've attached a small pipebug.go file which demonstrates the problem.
Attachments:
- pipebug.go (614 bytes)