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

Fix SemaphoreSlim release logic #941

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Fix SemaphoreSlim release logic #941

merged 1 commit into from
Dec 12, 2024

Conversation

dluc
Copy link
Collaborator

@dluc dluc commented Dec 12, 2024

Under some circumstances, SemaphoreSlim.WaitAsync() can fail, e.g. throwing an OperationCanceledException. In these cases, the internal semaphore counter didn't change, so SemaphoreSlim.Release() should not be called, to avoid exceptions.

Classes affected:

  • SqlServerMemory (initialization)
  • SimpleQueue (message dispatching)

@dluc dluc merged commit e8ac5fc into microsoft:main Dec 12, 2024
6 checks passed
@dluc dluc deleted the fixlocks branch December 12, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant