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

[Bug] SemaphoreFullException in ClientCredentialRequest when cancellation token is canceled #4472

Closed
pmaytak opened this issue Dec 15, 2023 · 1 comment · Fixed by #4469
Closed
Assignees
Labels
bug confidential-client P2 regression Behavior that worked in a previous release that no longer works in a newer release scenario:ManagedIdentity
Milestone

Comments

@pmaytak
Copy link
Contributor

pmaytak commented Dec 15, 2023

Library version used

4.56.0

.NET version

Scenario

ManagedIdentityClient - managed identity

Is this a new or an existing app?

None

Issue description and reproduction steps

await s_semaphoreSlim.WaitAsync(cancellationToken).ConfigureAwait(false);

The semaphore.Wait is called inside a try. When the cancellation token is cancelled, a TaskCancelledException is thrown without the semaphore being acquired, and finally is called trying to release the semaphore which was not acquired causing a SemaphoreFullException.

Relevant code snippets

No response

Expected behavior

When cancellation token is cancelled, the request should be cancelled. The semaphore.Wait should be called outside of the try statement.

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

Regression in 4.56.0 - #4309

Solution and workarounds

No response

@pmaytak pmaytak self-assigned this Dec 15, 2023
@pmaytak pmaytak added this to the 4.59.0 milestone Dec 15, 2023
@pmaytak pmaytak moved this from Committed to In Progress in MSAL Customer Trust / QM Dec 15, 2023
@pmaytak pmaytak moved this from In Progress to Waiting for Code Review in MSAL Customer Trust / QM Dec 16, 2023
@pmaytak pmaytak changed the title [Bug] SemaphoreFullException in ClientCredentialRequest when cancellation token is cancelled [Bug] SemaphoreFullException in ClientCredentialRequest when cancellation token is canceled Dec 21, 2023
@github-project-automation github-project-automation bot moved this from Waiting for Code Review to Done in MSAL Customer Trust / QM Dec 21, 2023
@pmaytak
Copy link
Contributor Author

pmaytak commented Jan 17, 2024

The fix is released in MSAL 4.59.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confidential-client P2 regression Behavior that worked in a previous release that no longer works in a newer release scenario:ManagedIdentity
Projects
Archived in project
2 participants