-
Notifications
You must be signed in to change notification settings - Fork 467
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
Graceful shutdown the workers when reducing worker threads #1863
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
git-hulk
force-pushed
the
graceful-shutdown-workers
branch
2 times, most recently
from
November 2, 2023 12:49
01df71b
to
9b7e839
Compare
PragmaTwice
reviewed
Nov 3, 2023
PragmaTwice
reviewed
Nov 3, 2023
This PR opened before changing the sonar reconfigured, so just ignore it. cc @PragmaTwice |
PragmaTwice
reviewed
Nov 4, 2023
torwig
previously approved these changes
Nov 10, 2023
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.
LGTM
git-hulk
force-pushed
the
graceful-shutdown-workers
branch
from
November 16, 2023 01:24
29687c4
to
e328917
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
torwig
approved these changes
Nov 16, 2023
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.
#1855 introduced the data race even only migrating the non-blocking connections. For example:
T1: C0(connection) is running the command Config::Set on W0(worker) and C1 is running another command on W1. C0 got the exclusive lock for executing commands and C1 will wait for the lock inside ExecuteCommands.
T2: C0 migrates C1 to W0 after reducing the number of worker threads, but the ExecuteCommands function will continue executing after migrating. So both W0 and W1 will access the C1 at the same time.
To avoid this, I simply don't migrate the connection if it has any running command and delay to shut down the worker, so that old connections have a chance to complete the running command.