-
Notifications
You must be signed in to change notification settings - Fork 38.8k
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
Report a watch error instead of eating it when we can't decode #73937
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smarterclayton 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 |
I may change this to an internal error instead of a 418, to be consistent with when we fail to renegotiate. |
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
staging/src/k8s.io/apimachinery/pkg/watch/streamwatcher_test.go
Outdated
Show resolved
Hide resolved
/retest |
/hold |
bd94058
to
cc64c98
Compare
/retest |
1 similar comment
/retest |
Updated to return a 500 and cleaned up test, PTAL |
/cc |
/cc @mbohlool |
/assign @deads2k |
Oh great, looks good to me (fwiw). |
Clients are required to handle watch events of type ERROR, so instead of eating the decoding error we should pass it on to the client. Use NewGenericServerError with isUnexpectedResponse to indicate that we didn't get the bytes from the server we were expecting. For watch, the 415 error code is roughly correct and we will return an error to the client that makes debugging a failure in either server watch or client machinery much easier. We do not alter the behavior when it appears the response is an EOF or other disconnection.
cc64c98
to
89620d5
Compare
I don't want to regress that code path here - we're very careful about removing error handling in client-go so it would be better to deal with that in a separate issue. |
/retest |
@caesarxuchao PTAL |
/lgtm |
Clients are required to handle watch events of type ERROR, so instead
of eating the decoding error we should pass it on to the client. Use
NewGenericServerError with isUnexpectedResponse to indicate that we
didn't get the bytes from the server we were expecting. For watch, the
415 error code is roughly correct and we will return an error to the
client that makes debugging a failure in either server watch or client
machinery much easier.
We do not alter the behavior when it appears the response is an EOF
or other disconnection.
/kind bug
This was discovered while writing an e2e test to verify #62175