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

core: fix RejectedExecutionException in Retriable Stream #9626

Merged
merged 4 commits into from
Nov 22, 2022

Conversation

YifeiZhuang
Copy link
Contributor

@YifeiZhuang YifeiZhuang commented Oct 14, 2022

fix #9547

revision 1

Add big negative integer to pending stream count when cancelled. The count is used to delay closing master listener until streams fully drained.
Increment pending stream count before creating one. The count is also used to indicate callExecutor is safe to be used. New stream not created if big negative number was added, i.e. stream cancelled. New stream is created if not cancelled, callExecutor is safe to be used, because cancel will be delayed.

revision 2

  1. incrementing pending stream count only when cancel is not called, otherwise no op. This is to prevent the count never goes to Integer.MIN_VALUE.
  2. create new streams (retry, hedging) is moved to the main thread, before callExecutor calls drain.
  3. minor refactor the masterListener.close() scenario.

@YifeiZhuang
Copy link
Contributor Author

@ejona86 , do you want to approve? So that we can try import next monday. global tap seems fine.

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After changes for my two comments, the relationship with createSubstream()+inFlightSubStreams+callExecutor becomes more clear. We could end up moving the inFlightSubStreams increment to createSubstream() itself, maybe returning null if the increment fails.

@YifeiZhuang YifeiZhuang merged commit b593871 into grpc:master Nov 22, 2022
@YifeiZhuang YifeiZhuang deleted the inflight-substream-counter branch November 22, 2022 21:04
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RejectedExecution exception after call closed
2 participants