Repository navigation
Fix virtual-thread deadlocks during synchronous paging - #50918
Merged
Alan Zimmer (alzimmermsft) merged 4 commits intoOct 26, 2026
Merged
Conversation
vcolin7
marked this pull request as ready for review
October 23, 2026 04:31
vcolin7
requested review from
a team,
Jonathan Giles (JonathanGiles),
Alan Zimmer (alzimmermsft) and
Vinay Gera (g2vinay)
as code owners
October 23, 2026 04:31
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused lock replacement preserves existing behavior, has targeted regression coverage, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
Fixes synchronous paging deadlocks reported in #46231 by avoiding virtual-thread carrier pinning in Azure Core on Java 21.
Changes:
- Replaces the paging monitor with a private
ReentrantLock, preserving the critical section and error handling. - Adds isolated-JVM tests with limited carriers and lock-release tests for failure and interruption.
- Corrects Identity executor guidance and documents the fix in Azure Core’s changelog.
| File | Description |
|---|---|
| sdk/identity/azure-identity/TROUBLESHOOTING.md | Clarifies the default executor and virtual-thread workarounds. |
| sdk/core/azure-core/src/test/java/com/azure/core/http/rest/PagedIterableConcurrencyTests.java | Adds carrier-starvation and exceptional lock-release coverage. |
| sdk/core/azure-core/src/main/java/com/azure/core/util/paging/ContinuablePagedByIteratorBase.java | Replaces intrinsic synchronization with a lock released in finally. |
| sdk/core/azure-core/CHANGELOG.md | Records the synchronous paging deadlock fix. |
Review effort: Balanced
Alan Zimmer (alzimmermsft)
approved these changes
Oct 23, 2026
Jair Myree (jairmyree)
approved these changes
Oct 26, 2026
Jair Myree (jairmyree)
approved these changes
Oct 26, 2026
Alan Zimmer (alzimmermsft)
deleted the
vcolin7-identity-thread-deadlock
branch
October 26, 2026 15:28
This file contains hidden or 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
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.
Description
Fixes synchronous paging holding an intrinsic monitor while Identity waits for MSAL. On Java 21, those callers can occupy all carrier threads and prevent the shared executor's token work from running.
Replaces the paging monitor with a private
ReentrantLock, preserving the existing critical section and error handling. Adds isolated-JVM coverage with scarce carriers and tests for lock release after failure or interruption. Corrects Identity's executor and virtual-thread workaround documentation. Public APIs and default executor settings are unchanged.Fixes #46231.
Validation
Before the fix, all eight new Java 21 low-carrier paging cases failed with timeouts. After the fix, the paging suites passed on Java 21 and 25 (132 cases each). Java 8 passed 124 cases and skipped the eight virtual-thread cases as expected.
Commands were run on Windows with
JAVA_HOMEandPATHset to the indicated JDK:All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines
Written with the help of Copilot