-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
DelayedClientTransport can trigger RejectedExecutionException #6283
Comments
|
ejona86
added a commit
to ejona86/grpc-java
that referenced
this issue
Dec 17, 2020
ejona86
added a commit
to ejona86/grpc-java
that referenced
this issue
Dec 21, 2020
ejona86
added a commit
to ejona86/grpc-java
that referenced
this issue
Dec 22, 2020
DelayedClientTransport needs to avoid becoming terminated while it owns RPCs. Previously DelayedClientTransport could terminate when some of its RPCs had their realStream but realStream.start() hadn't yet been called. To avoid that, we now make sure to call realStream.start() synchronously with setting realStream. Since start() and the method calls before start execute quickly, we can run it in-line. But it does mean we now need to split the Stream methods into "before start" and "after start" categories for queuing. Fixes grpc#6283
ejona86
added a commit
that referenced
this issue
Jan 20, 2021
DelayedClientTransport needs to avoid becoming terminated while it owns RPCs. Previously DelayedClientTransport could terminate when some of its RPCs had their realStream but realStream.start() hadn't yet been called. To avoid that, we now make sure to call realStream.start() synchronously with setting realStream. Since start() and the method calls before start execute quickly, we can run it in-line. But it does mean we now need to split the Stream methods into "before start" and "after start" categories for queuing. Fixes #6283
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We've seen the following exception (b/142475326):
The application was using our default executor, which means we scheduled work after the channel terminated or the reference counting is broken.
When the channel terminates it guarantees that it is done scheduling work on the executor, but not that all the scheduled work is complete. The problem here appears that some of that work is scheduling more work on the same executor.
Specifically, this runnable can produce more runnables:
grpc-java/core/src/main/java/io/grpc/internal/DelayedClientTransport.java
Lines 297 to 302 in ddaf1c8
But while that runnable is running, 'stream' is likely to have already been removed from 'pendingStreams'. So if the channel is shut down at that point the transport will terminate abruptly and no other transport will "own" the call yet, so the entire channel can terminate before the runnable completes.
We could either split start() draining to a separate method in DelayedStream so that newStream()+start() can be called directly within reprocess(), or we could keep a counter for the number of streams still draining and delay transport termination until it reaches zero.
The text was updated successfully, but these errors were encountered: