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
Close eventfd shutdown/wakeup race by closely tracking epoll edges #9535
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Motivation This is another iteration of netty#9476. Modifications Instead of maintaining a count of all writes performed and then using reads during shutdown to ensure all are accounted for, just set a flag after each write and don't reset it until the corresponding event has been returned from epoll_wait. This requires that while a write is still pending we don't reset wakenUp, i.e. continue to block writes from the wakeup() method. Result Race condition eliminated. Fixes netty#9362
Can one of the admins verify this patch? |
@netty-bot test this please |
ejona86
approved these changes
Sep 4, 2019
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.
Looks good. Thank you!
@njhill nice job! Please put it on your list for "back ports to do for master" :) |
Merged
johnou
added a commit
to johnou/netty
that referenced
this pull request
Sep 19, 2019
…g epoll edges (netty#9535)"" This reverts commit 8280252.
njhill
added a commit
to njhill/netty
that referenced
this pull request
Sep 27, 2019
Motivation This is a vestige that was removed in the original PR netty#9535 before it was reverted, but we missed it when re-applying in netty#9586. It means there is a possible race condition because a wakeup event could be missed while shutting down, but the consequences aren't serious since there's a 1 second safeguard timeout when waiting for it. Modification Remove call to epollWaitNow() in EpollEventLoop#closeAll() Result Cleanup redundant code, avoid shutdown delay race condition
normanmaurer
pushed a commit
that referenced
this pull request
Oct 7, 2019
) Motivation This is a vestige that was removed in the original PR #9535 before it was reverted, but we missed it when re-applying in #9586. It means there is a possible race condition because a wakeup event could be missed while shutting down, but the consequences aren't serious since there's a 1 second safeguard timeout when waiting for it. Modification Remove call to epollWaitNow() in EpollEventLoop#closeAll() Result Cleanup redundant code, avoid shutdown delay race condition
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This is another iteration of #9476.
Modifications
Instead of maintaining a count of all writes performed and then using reads during shutdown to ensure all are accounted for, just set a flag after each write and don't reset it until the corresponding event has been returned from
epoll_wait
.This requires that while a write is still pending we don't reset
wakenUp
, i.e. continue to block writes from thewakeup()
method.Result
Race condition eliminated. Fixes #9362