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 closing stdin #1899
Fix closing stdin #1899
Conversation
We'd also like to backport this onto the 0.11 branch (and ideally tag a release) so we can pull this into moby/moby. |
internal/hcs/process.go
Outdated
if process.stdin == nil { | ||
return nil | ||
} | ||
|
||
process.stdin.Close() | ||
process.stdin = nil | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nit pick, but I'd suggest flipping the contents of the if statement so it matches the other two functions.
if process.stdin == nil { | |
return nil | |
} | |
process.stdin.Close() | |
process.stdin = nil | |
if process.stdin != nil { | |
process.stdin.Close() | |
process.stdin = nil | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Thanks
Send the modify request even if stdin is nil, let the process handle it Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
2f57ced
to
07b74c0
Compare
I'm separately curious why we don't (or don't need to) send |
I think since closing IO is (almost?) always followed closely by a |
@rumpl |
@helsaawy We had this test failing. It's running |
Send the modify request even if stdin is nil, let the process handle it Signed-off-by: Djordje Lukic <djordje.lukic@docker.com> (cherry picked from commit 27df1b9)
Thanks for the merge! What can we do to help get this backported to 0.11 and then get a new release |
Just noticed https://github.com/moby/moby/blob/20f96354699d20eeb4674d3944486b5d73c256b2/integration/container/exec_test.go#L19 -- is this potentially the missing |
Backport is open at #1900 |
Send the modify request even if stdin is nil, let the process handle it Signed-off-by: Djordje Lukic <djordje.lukic@docker.com> (cherry picked from commit 27df1b9) Signed-off-by: Maksim An <maksiman@microsoft.com>
We should definitely check if it fails still. A lot has happened in 2 years |
From memory there was some hcsshim/containerd io-hang issue like this that was never resolved. And last time this test came up, I said the same thing: moby/moby#41479 (comment) I thought there had been some discussion in a containerd issue of a hcsshim-side fix being needed, but I can't actually find any evidence of the issue I'm thinking of in the hcsshim, containerd, or moby repos. >_< #1296 is the closest I can find, and I'm not sure it's related because it seems to be about spurious errors, not hangs. I will note that |
Send the modify request even if stdin is nil, let the process handle it Signed-off-by: Djordje Lukic <djordje.lukic@docker.com> (cherry picked from commit 27df1b9) Signed-off-by: Maksim An <maksiman@microsoft.com>
Send the modify request even if stdin is nil, let the process handle it Signed-off-by: Djordje Lukic <djordje.lukic@docker.com> (cherry picked from commit 27df1b9) Signed-off-by: Maksim An <maksiman@microsoft.com>
Send the modify request even if stdin is nil, let the process handle it Signed-off-by: Djordje Lukic <djordje.lukic@docker.com> (cherry picked from commit 27df1b9) Signed-off-by: Maksim An <maksiman@microsoft.com>
Send the modify request even if stdin is nil, let the process handle it Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
moby tried updating hcsshim to 0.11.0 and we had some failures in our tests (see this PR).
We tracked the issue to this change, the close request wasn't forwarded any more if stdin is nil. This change moves the nil check to after the modify request, letting the process handle it.