New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/exec: exec pipes not closed when LookupPath fails #5071

Closed
gopherbot opened this Issue Mar 18, 2013 · 4 comments

Comments

Projects
None yet
4 participants
@gopherbot
Copy link

gopherbot commented Mar 18, 2013

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:

  1. pipebug.go (614 bytes)
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

ianlancetaylor commented Mar 18, 2013

Comment 1:

Labels changed: added priority-soon, go1.1maybe, removed priority-triage.

@bradfitz

This comment has been minimized.

Copy link
Member

bradfitz commented Mar 18, 2013

Comment 2:

Sent https://golang.org/cl/7799046/

Owner changed to @bradfitz.

Status changed to Started.

@bradfitz

This comment has been minimized.

Copy link
Member

bradfitz commented Mar 18, 2013

Comment 3:

This issue was closed by revision 9db0583.

Status changed to Fixed.

@rsc rsc added this to the Go1.1 milestone Apr 14, 2015

@rsc rsc removed the go1.1maybe label Apr 14, 2015

@golang golang locked and limited conversation to collaborators Jun 24, 2016

@gopherbot

This comment has been minimized.

Copy link
Author

gopherbot commented Feb 23, 2017

CL https://golang.org/cl/37343 mentions this issue.

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.