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

Build hangs with MSBUILDNODECONNECTIONTIMEOUT=0 #5911

Closed
ladipro opened this issue Nov 25, 2020 · 0 comments · Fixed by #5917
Closed

Build hangs with MSBUILDNODECONNECTIONTIMEOUT=0 #5911

ladipro opened this issue Nov 25, 2020 · 0 comments · Fixed by #5917
Assignees

Comments

@ladipro
Copy link
Member

ladipro commented Nov 25, 2020

Issue Description

MSBuild hangs when attempting to build with the MSBUILDNODECONNECTIONTIMEOUT environment variable set to 0.

Steps to Reproduce

set MSBUILDNODECONNECTIONTIMEOUT=0
msbuild repro.proj

repro.proj:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="Build">
    <Message Text="Hello world!" />
  </Target>
</Project>

Expected Behavior

The build fails with an internal error like "In-proc node failed to start up within 0ms".

Actual Behavior

The build hangs.

Analysis

Caused by the BuildSubmission not getting completed if an exception categorized as "critical" is thrown.

The exception is thrown here:

ErrorUtilities.VerifyThrow(connected, "In-proc node failed to start up within {0}ms", connectionTimeout);

And caught here:

Versions & Configurations

Version 16.8.2+25e4d540b

@ladipro ladipro added bug needs-triage Have yet to determine what bucket this goes in. labels Nov 25, 2020
@benvillalobos benvillalobos removed the needs-triage Have yet to determine what bucket this goes in. label Nov 25, 2020
Forgind pushed a commit that referenced this issue Dec 4, 2020
The logic to handle exceptions thrown on logging and communication threads was trying to make the build submission fail with the exception but it didn't always complete it. This manifested as the build hanging, for example when building with MSBUILDNODECONNECTIONTIMEOUT = 0, which is almost guaranteed to throw InternalErrorException in InstantiateNode.

This PR fixes it by making sure that all submissions are completed in OnThreadException. Unlike the original code, proper care is taken to avoid race conditions - i.e. the build result is mutated only if hasn't already been passed to the completion handler.

Fixes #5911
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants