diff options
author | Sebastiaan van Stijn <thaJeztah@users.noreply.github.com> | 2016-07-27 18:53:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-27 18:53:07 +0200 |
commit | c62b19f1e345e53435c2d94ff71f939a8e54ce2f (patch) | |
tree | 01c277d09573a1c004fed2305ce71a11aadc871a | |
parent | a3f206372f58f45fb5f738d3a1bf1b8e78ee9cbf (diff) | |
parent | d6b53d91d7d5e95239dda9a33fd6146cf57fa3f2 (diff) | |
download | docker-c62b19f1e345e53435c2d94ff71f939a8e54ce2f.tar.gz |
Merge pull request #25126 from mlaventure/fix-weird-rpc-lock
Attach stdin after attach stdout/err to avoid an rpc lock
-rw-r--r-- | daemon/monitor.go | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/daemon/monitor.go b/daemon/monitor.go index 30d36836f8..1f97efb472 100644 --- a/daemon/monitor.go +++ b/daemon/monitor.go @@ -119,22 +119,6 @@ func (daemon *Daemon) AttachStreams(id string, iop libcontainerd.IOPipe) error { } } - if stdin := s.Stdin(); stdin != nil { - if iop.Stdin != nil { - go func() { - io.Copy(iop.Stdin, stdin) - iop.Stdin.Close() - }() - } - } else { - if c != nil && !c.Config.Tty { - // tty is enabled, so dont close containerd's iopipe stdin. - if iop.Stdin != nil { - iop.Stdin.Close() - } - } - } - copyFunc := func(w io.Writer, r io.Reader) { s.Add(1) go func() { @@ -152,5 +136,21 @@ func (daemon *Daemon) AttachStreams(id string, iop libcontainerd.IOPipe) error { copyFunc(s.Stderr(), iop.Stderr) } + if stdin := s.Stdin(); stdin != nil { + if iop.Stdin != nil { + go func() { + io.Copy(iop.Stdin, stdin) + iop.Stdin.Close() + }() + } + } else { + if c != nil && !c.Config.Tty { + // tty is enabled, so dont close containerd's iopipe stdin. + if iop.Stdin != nil { + iop.Stdin.Close() + } + } + } + return nil } |