-
Notifications
You must be signed in to change notification settings - Fork 451
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
fixing race condition in worker shutdown #9738
Merged
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
brettsam
changed the title
adding test to check for a race
(don't review...) adding test to check for a race
Dec 12, 2023
brettsam
commented
Dec 12, 2023
brettsam
commented
Dec 12, 2023
brettsam
changed the title
(don't review...) adding test to check for a race
fixing race condition in worker shutdown
Dec 12, 2023
liliankasem
approved these changes
Dec 13, 2023
soninaren
approved these changes
Dec 13, 2023
v-imohammad
pushed a commit
that referenced
this pull request
Dec 13, 2023
8 tasks
8 tasks
VpOfEngineering
pushed a commit
that referenced
this pull request
Dec 14, 2023
8 tasks
v-imohammad
pushed a commit
that referenced
this pull request
Dec 14, 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.
Issue describing the changes in this PR
In the code here:
azure-functions-host/src/WebJobs.Script/Workers/Rpc/WebHostRpcWorkerChannelManager.cs
Lines 267 to 268 in 95a1a4b
... the call to TryRemove() is not thread-safe as it's not on a
ConcurrentDictionary
. It's possible that multiple shutdown requests will flow through this code and eventually try to start up new workers. This can lead to an error message ofNumber of initialized language workers exceeded
as we'd be creating more than we shut down.This change switches to
ConcurrentDictionary
. The test that I've added only every failed while debugging... I was unable to get it to fail while running normally, but I'll leave it in as an extra check.Pull request checklist
release_notes.md
Additional information
Additional PR information