-
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
Fix client call close race condition message leak #7106
Conversation
I guess another option instead of throwing/handling That should be safe since the runnable is always a |
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.
I don't think we can assume RejectedExecutionException are due to the close race. We keep seeing users prematurely closing executors.
In #636 (comment) I had the idea of a "fallback" executor, which would be great in general. I'm not wild about using it for this case, since I do generally think we should be avoiding scheduling work on the executor after the call is complete, but I guess technically we could. I'd much rather fix the ordering problem.
Thanks @ejona86, I see that the more general part of this is a bit tricky. I wonder if a fallback executor could be avoided. There are two realistic cases I think - temporary thread/queue exhaustion and (permanent) premature executor shutdown. The latter case constitutes an app bug where all bets are off since the channel is then "broken" at least for async usage. It seems reasonable in this case to just log the error and not run any call close callbacks. To accommodate the former case, you could schedule a repeating task to re-attempt scheduling of the Irrespective of that, would a subset of this PR still be worthwhile (specifically the changes to |
@ejona86 shall I open another PR with just the |
@njhill, yeah, that sounds good. |
As reported in #7105. Not sure if this is how you want it done, but it does fix the problem.
Fixes #7105
Fixes #3557