-
Notifications
You must be signed in to change notification settings - Fork 43
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
Drain stdin on attach #991
Drain stdin on attach #991
Conversation
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.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: saschagrunert, sohankunkerkar The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Doesn't this just make flakes less likely? I am not familiar with all the details here, just a general suspicion of fixing race conditions with |
That's true. One way to fix it would be to increase the complexity by having cancellation tokens for input and output streams. I can follow-up on that, but I'm not sure if the effort is comparable to the test fix. |
+1 to not sleeping. The cancellation routine could loop on the data read to drain the buffer, and return on error or EOF. |
I think that's basically what current conmon does |
d2e4afd
to
119c650
Compare
The Kubernetes e2e test flakes because of a token cancellation race between stdin and attach read: ``` [FAIL] [sig-cli] Kubectl client Simple pod [It] should support inline execution and attach … << Timeline [FAILED] Expected <string>: read:stdin closed to contain substring <string>: read:value In [It] at: test/e2e/kubectl/kubectl.go:764 @ 01/04/23 15:09:48.618 ``` The issue is that we cancel the token immediately which stops reading from attach. But the container command `echo -n read: && cat && echo 'stdin closed'` within the test provides additional data, which gets no time to be delivered. We now drain stdin accordingly and wait for all data to be passed down to the receiver. Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
119c650
to
86f4c99
Compare
I think we can simply |
lgtm |
/lgtm good idea! |
What type of PR is this?
/kind failing-test
What this PR does / why we need it:
The Kubernetes e2e test flakes because of a token cancellation race between stdin and attach read:
https://github.com/kubernetes/kubernetes/blob/5cbd6960c805c22e1c741dde3ce9f2e10f869bce/test/e2e/kubectl/kubectl.go#L757-L766
The issue is that we cancel the token immediately which stops reading from attach. But the container command
echo -n read: && cat && echo 'stdin closed'
within the test provides additional data, which gets no time to be delivered.We now drain stdin accordingly and wait for all data to be passed down to the receiver.
Which issue(s) this PR fixes:
Refers to #736
Special notes for your reviewer:
None
Does this PR introduce a user-facing change?