Skip to content

core: handle closed transport factory in InternalSubchannel without panic - #12984

Open
kannanjgithub wants to merge 1 commit into
grpc:masterfrom
kannanjgithub:estub-channel-panic
Open

core: handle closed transport factory in InternalSubchannel without panic#12984
kannanjgithub wants to merge 1 commit into
grpc:masterfrom
kannanjgithub:estub-channel-panic

Conversation

@kannanjgithub

@kannanjgithub kannanjgithub commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Catch IllegalStateException when starting a new transport against a closed transport factory and shut down the subchannel safely instead of letting it escape into the SynchronizationContext and causing a channel panic.

Internal yaqs
Related CL

…anic

Catch IllegalStateException when starting a new transport against a closed
transport factory and shut down the subchannel safely instead of letting it
escape into the SynchronizationContext and causing a channel panic.
@kannanjgithub
kannanjgithub requested a review from ejona86 August 11, 2026 13:19
@ejona86

ejona86 commented Aug 12, 2026

Copy link
Copy Markdown
Member

When #12985 goes in, this won't be necessary, right?

@kannanjgithub

Copy link
Copy Markdown
Contributor Author

#12985 will fix the reported problem of the transport factory lifecycle problem - to avoid closing it inadvertently when the OOB channel is shutdown by the Rls LB. However it also exposed a race condition that exists during legitimate closure of the transport factory during a channel shutdown, where an in-flight name resolution creates a new subchannel and tries to calls start a new transport.

@ejona86

ejona86 commented Aug 13, 2026

Copy link
Copy Markdown
Member

This is a hack, and is at best a temporary workaround. We should not be catching specific IllegalStateException/NullPointerException and other programmer errors; we should prevent them instead. In this case, it also assumes that any IllegalStateException is this specific exception that we have seen, but that is not guaranteed.

I don't see a log/exception that shows a NameResolver race is happening. I see one where a name resolver calls into the synchronization context, but the runnable being executed was not from the NameResolver. Any function lower than SynchronizationContext.execute() on the stack is not necessarily related to the code running within the syncContext.

We shouldn't really have problems here due to NameResolvers, because name resolvers don't create/manage subchannels. And we stop delivering updates from a NR once it is shut down.

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.

2 participants