Repository navigation
Conversation
Watch.stop() shuts the response socket down so that a stream blocked
on a quiet watch or a followed log returns at once. The blocked read
then fails, typically with urllib3 ProtocolError("Response ended
prematurely"), and Watch.stream() raised that error to the caller. A
caller that stops the stream from another thread, which is what the
shutdown is for, got an exception instead of the end of the stream.
When stop was requested, end the stream on any error raised while
reading it instead of raising it. Errors raised without a stop request
propagate as before, and the response is still closed and released.
Add a test that stops a watch stream and a followed log from another
thread while the read is blocked, and checks that the stream ends
without an error after the first item.
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: ilcm96 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Member
|
/assign @yliaog |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
What this PR does / why we need it:
Watch.stop()shuts the response socket down (#2486) so that a stream blocked on a quiet watch returns at once. Whenstop()is called from another thread whilestream()is blocked in a read, the read fails andstream()raises the error, e.g.urllib3.exceptions.ProtocolError: Response ended prematurely, so a normal stop looks like a connection failure. Following a pod log withWatch.stream(read_namespaced_pod_log, follow=True)is affected too.This PR ends the stream quietly when reading fails after stop was requested, the same rule #2820 applied to
SharedInformer. Errors raised without a stop request propagate as before, and the response is still closed and released.Which issue(s) this PR fixes:
None filed.
Special notes for your reviewer:
How I tested it:
ProtocolErrorin 5 of 5 runs each on master; now all 10 end normally.Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: