-
Notifications
You must be signed in to change notification settings - Fork 360
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 "http: read on closed response body" error #8332
Fix "http: read on closed response body" error #8332
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.
Why are we not logging the number of attempts anymore?
@N-o-Z the opposite, we now start logging them in case of an error |
I might be color blind... 😅 |
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.
I don't understand why this fixes an issue.
-
The docs explicitly say "If overriding this, be sure to close the body if needed.". We closed the body. How does this create a double-close?
-
The comment for the behaviour of customErrorHandler says:
// We need to consume response bodies to maintain http connections, but // limit the size we consume to respReadLimit.
IIUC this means that we lose this behaviour. Why is this a good thing? Doesn't it mean retries will be much slower?
Not blocking or approving because I don't understand this PR. Will be happy to change this.
|
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.
IIUC the issue is that customErrorHandler - which tries to prevent detailing the error message - has a bug and returns the response.
LGTM!
This is truly a bug, but the bigger picture is that this code is redundant and adds no value. |
Closes #8331
Change Description
The current custom error handler is doing redundant work that eventually causes the
read on closed response body
.Current Flow
Example for generated code from point 5:
Removing the custom error handler will not affect the current usage which will behave as we expect. This is because the behavior of the default retry client is to drain the body and return an error without the response. That way the generated code will not try to read the response, but will return an error...