Skip to content
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

Fix attach stream closing issues #10079

Merged
merged 1 commit into from
Jan 14, 2015

Conversation

tonistiigi
Copy link
Member

This small fix fixes 2 different issues:

  • Attach after detach in master

Attaching after once detached doesn't work in current master. v1.4.1 isn't affected. Regression is at #9511.

docker run -it --name test busybox
^P^Q
docker attach test
<no prompt>

The problem is that when stdout/stderr closed cStdin.Close() is always called on if in stdinOnce mode. This closes the process stdin.

After stdout/stderr close, stdin.Close() is only ran if we are on stdinOnce mode. Goroutine must be always cleaned. Regression is at #8571.


We never actually need to close container stdin after stdout/stderr finishes. We only need to close the stdin goroutine. In some cases this also means closing stdin but that is already controlled by the goroutine itself.

/cc @LK4D4 @jfrazelle @cpuguy83

Signed-off-by: Tonis Tiigi tonistiigi@gmail.com

Fixes: moby#9860
Fixes: detach and attach tty mode

We never actually need to close container `stdin` after `stdout/stderr` finishes. We only need to close the `stdin` goroutine. In some cases this also means closing `stdin` but that is already controlled by the goroutine itself.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi
Copy link
Member Author

See #10078 also, should you want to merge that instead I can limit mine to tests only.

@jessfraz
Copy link
Contributor

yours is simpler LGTM thanks

@crosbymichael
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants