-
Notifications
You must be signed in to change notification settings - Fork 87
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: don't emit error event during stream handoff #1592
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.
Thanks @leahecole. I don't know much about the internals of gax, but the outcome in the description is exactly what we need for retries to work upstream.
I'll take a look at the system test failure on Monday! |
// retryStream must be destroyed here for the stream handoff part of retries to function properly | ||
// but the error event should not be passed - if it emits as part of .destroy() | ||
// it will bubble up early to the caller | ||
retryStream.destroy(); |
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.
Future idea, this will be a great place to add some tracing whenever we add that.
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.
Thanks for the super clear explanation in the PR description! Code is really easy to understand!
fixes b/338064353
OLD BEHAVIOR: in
streamingRetryRequest.ts
as part ofonResponse
, an'error'
event would be emitted while the retryStream is being destroyed. This event (usually the first error event in a retry sequence) would be bubbled up to the caller as part of the stream handoff that happens in retries where the old stream is destroyed, a new one is created, and events are forwarded. The call would still resume afterwards and continue successfully, but that error would be raised when it shouldn't have beenNEW BEHAVIOR: The stream is still destroyed, but no error event is emitted. Stream handoff is the same as before, call continues, and the only errors that would be bubbled up to the caller should be ones that are not retry eligible.
This PR makes that one line behavior change and adjusts the test-application to expect that behavior. Our tests beforehand were doing error handling that is atypical of what a client would do (we were either ignoring errors or checking info about them before raising them, which should be handled at the gax level)
Major thanks to @danieljbruce for noticing the resulting behavior and raising it.