Skip to content
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

Streams with prefecth_first_result do not convert grpc errors #731

Open
daniel-sanche opened this issue Oct 9, 2024 · 1 comment
Open
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@daniel-sanche
Copy link
Contributor

daniel-sanche commented Oct 9, 2024

one task of grpc_helpers is to wrap grpc channels in error_remapped_callable, converting grpc errors into api_core.exception types. But this error remapping is skipped when processing a streaming rpc with prefetch_first enabled.

When prefetch_first is enabled, the StreamingResponseIterator calls next as part of its init. But if there is an error as part of the next call, the grpc error is raised immediately, without being wrapped

Because the error is not wrapped, and it is raised outside the usual call loop, this will cause retryable errors to not be retried properly


To solve this, we should probably add a case to this try/catch:

       except grpc.RpcError as exc:
            self._stored_first_result = exc

And then raise it as part of __next__ if present here

related: b/368027810

@daniel-sanche
Copy link
Contributor Author

Actually, looking closer, the exception should be handled up higher in the stack by this catch. It's not clear why we're seeing the errors we see in b/368027810

@vchudnov-g vchudnov-g added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants