Skip to content

Add traces and timeout for node shutdown #12129

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

Closed
wants to merge 1 commit into from

Conversation

YuliiaKovalova
Copy link
Member

This PR helps with diagnosing and potentially working around a problem where nodes don't signal completion due to crash reason: https://developercommunity.visualstudio.com/t/Canceling-build-failed-no-path-to-conti/10933619

The selected timeout is 5 seconds, but we can extend/cut it.

@YuliiaKovalova YuliiaKovalova requested review from Copilot and rainersigwald and removed request for Copilot July 8, 2025 14:29
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 PR adds tracing events for node shutdown success/failure and implements a timeout when waiting for node shutdown in EndBuild to prevent indefinite hangs.

  • Introduce a _nodesShutDownSuccessfully flag and use WaitOne(TimeSpan.FromSeconds(5)) in EndBuild, logging failures on timeout.
  • Add NodeShutdownFailure and NodeShutdownSuccess events to MSBuildEventSource and emit them when nodes shut down.

Reviewed Changes

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

File Description
MSBuildEventSource.cs Add NodeShutdownFailure and NodeShutdownSuccess event methods.
BuildManager.cs Use timed wait for node shutdown, log failure/success events, add _nodesShutDownSuccessfully.
Comments suppressed due to low confidence (4)

src/Build/BackEnd/BuildManager/BuildManager.cs:272

  • The XML comment for _nodesShutDownSuccessfully is vague and describes it as a debugging property. Update it to explain the flag’s purpose (i.e., whether all nodes shut down within the timeout).
        private bool _nodesShutDownSuccessfully;

src/Framework/MSBuildEventSource.cs:683

  • The new NodeShutdownFailure event lacks an XML doc comment. Add <summary> and <param> tags to describe the event semantics and the additionalInformation parameter.
        [Event(94, Keywords = Keywords.All)]

src/Framework/MSBuildEventSource.cs:689

  • The new NodeShutdownSuccess event is missing documentation. Include an XML comment to explain when it’s emitted and the meaning of its parameter.
        [Event(95, Keywords = Keywords.All)]

src/Build/BackEnd/BuildManager/BuildManager.cs:272

  • Storing this state in a private field risks carrying over the value between builds. Consider making it a local variable in EndBuild or resetting it at the start of each build.
        private bool _nodesShutDownSuccessfully;

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.

2 participants