Skip to content

core: Fail the RPC if the picker throws - #13216

Open
ejona86 wants to merge 1 commit into
grpc:masterfrom
ejona86:picksubchannel-catch-exceptions
Open

ejona86 wants to merge 1 commit into
grpc:masterfrom
ejona86:picksubchannel-catch-exceptions

Conversation

@ejona86

@ejona86 ejona86 commented Dec 2, 2026

Copy link
Copy Markdown
Member

It is incorrect for pickers to throw, but there's quite a bit of code in LB policies these days and some of them consult data from the RPC itself, so it is a good idea to handle exceptions gracefully if bugs crop up.

In particular, if reprocess() throws it could put the channel in panic mode as it is run from the syncContext. Instead of having the exception propagate up the stack, we can just fail the RPC and use the regular error handling flow.

This was noticed when discussing how RLS behaves with binary headers.

It is incorrect for pickers to throw, but there's quite a bit of code in
LB policies these days and some of them consult data from the RPC
itself, so it is a good idea to handle exceptions gracefully if bugs
crop up.

In particular, if reprocess() throws it could put the channel in panic
mode as it is run from the syncContext. Instead of having the exception
propagate up the stack, we can just fail the RPC and use the regular
error handling flow.

This was noticed when discussing how RLS behaves with binary headers.
@ejona86
ejona86 requested a review from kannanjgithub December 2, 2026 18:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants