Skip to content

[17.14] Avoid hang when similar build requests are serviced #12197

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

Merged
merged 3 commits into from
Jul 22, 2025

Conversation

rainersigwald
Copy link
Member

Backports #11862 to 17.14.

Work item (Internal use): devdiv2530919

Summary

The MSBuild scheduler could hang when two similar-but-not-identical requests were received and serviced in short proximity. VS calling patterns trigger this sometimes.

This change handles the problematic case and additionally provides breadcrumbs in the memory dump that this situation occurred to improve future diagnosability of related issues.

Customer Impact

VS hang observed from telemetry; VS Perf team wants backport.

Regression?

No

Testing

Has been in main (.NET SDK 10 builds) and internal VS preview for ~1 month, with good telemetry from VS int preview.

Risk

Low due to bake time in main/int preview.

@Copilot Copilot AI review requested due to automatic review settings July 18, 2025 20:09
@rainersigwald rainersigwald requested a review from a team as a code owner July 18, 2025 20:09
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This backport addresses a MSBuild scheduler hang issue when two similar-but-not-identical build requests are serviced in close proximity. The fix prevents Visual Studio from hanging by properly handling cases where cached results cannot satisfy duplicate requests, and adds diagnostic fields to improve future debugging.

  • Fixes the scheduler hang by allowing unscheduled requests to remain in the queue for proper rebuilding instead of incomplete handling
  • Adds diagnostic fields _hitNoLoggingCompleted and _noLoggingCompletedSubmissionDetails for memory dump analysis
  • Includes comprehensive unit tests covering both cache hit and cache miss scenarios for duplicate requests

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Build/BackEnd/Components/Scheduler/Scheduler.cs Core fix for the hang issue with diagnostic breadcrumbs and improved error handling
src/Build/BackEnd/BuildManager/BuildManager.cs Minor variable rename for clarity (response → responses)
src/Build.UnitTests/BackEnd/Scheduler_Tests.cs Test infrastructure improvements and two new comprehensive tests for the fix
eng/Versions.props Version bump from 17.14.16 to 17.14.17 with formatting issue

@rainersigwald rainersigwald enabled auto-merge (squash) July 21, 2025 21:51
@rainersigwald rainersigwald merged commit a338add into vs17.14 Jul 22, 2025
10 checks passed
@rainersigwald rainersigwald deleted the backport/11862-to-vs17.14 branch July 22, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants