You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Writer set to exec.Cmd.Stdout (or Stderr) may fail. When that happens, underlying pipe is not closed, and command continues to run without noticing that something is wrong.
Here is an example. This little program starts "ls -lR /", which (usually) runs for a long time and produces lot of output. When our brokenWriter returns error, ls command continues to run. Buffer associated with the pipe in the kernel eventually gets filled, which in turn blocks ls, which will then never finish.
I think the solution is to close underlying pr pipe when goroutine created by Cmd.writerDescriptor detects error, similar to what goroutine in stdin method does
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
When exec.Cmd.Stdout writer returns error, associated pipe is not closed, and command continues to run, potentionally creating a deadlock
os/exec: When Cmd.Stdout writer returns error, associated pipe is not closed, and command continues to run, potentionally creating a deadlock
Apr 9, 2015
rsc
changed the title
os/exec: When Cmd.Stdout writer returns error, associated pipe is not closed, and command continues to run, potentionally creating a deadlock
os/exec: close read end of stdout/stderr pipe when copy loop stops
Jul 15, 2015
Writer set to
exec.Cmd.Stdout
(orStderr
) may fail. When that happens, underlying pipe is not closed, and command continues to run without noticing that something is wrong.Here is an example. This little program starts "ls -lR /", which (usually) runs for a long time and produces lot of output. When our
brokenWriter
returns error,ls
command continues to run. Buffer associated with the pipe in the kernel eventually gets filled, which in turn blocksls
, which will then never finish.I think the solution is to close underlying
pr
pipe when goroutine created by Cmd.writerDescriptor detects error, similar to what goroutine instdin
method doesThe text was updated successfully, but these errors were encountered: