Skip to content

Commit

Permalink
Re-enable IdenticalSubmissionsShouldCompleteAndNotHangTheBuildOnMissi…
Browse files Browse the repository at this point in the history
…ngTargetExceptions (#9253)

Fixes #9245

Context
The test was disabled to unblock PR CI.

Changes Made
Increased the relevant timeout.

Testing
The test is reliably passing now.

Notes
This turned out to be an issue with the sleep command we use on Windows. In some cases PowerShell can take a super long time to start. I have been able to reproduce locally by enabling Fusion logging. Thread times of the powershell process:

image

We spend almost 10 seconds just loading assemblies, so the timeout of 10 seconds for the entire build was not enough.

I don't have a full understanding of the mechanism that slows down PowerShell this much. At this point I'm happy we were able to confirm it's not a product issue, although I'm wondering if there is a better and more light-weight sleep command we could use on Windows instead (e.g. ping 127.0.0.1 -n <seconds>). Reviewers please opine.

EDIT: In my trace, file system operations block extensively with wdfilter.sys on the stack, so the likely explanation for the issue appearing all of a sudden is a Defender update.
  • Loading branch information
ladipro authored and MichalPavlik committed Oct 17, 2023
1 parent 9de0dd8 commit 56cb905
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Build.UnitTests/BackEnd/BuildManager_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4046,7 +4046,7 @@ public void MultiProcReentrantProjectWithCallTargetDoesNotFail()
}
}

[Fact(Skip = "https://github.com/dotnet/msbuild/issues/9245")]
[Fact]
public void IdenticalSubmissionsShouldCompleteAndNotHangTheBuildOnMissingTargetExceptions()
{
var projectContents =
Expand Down Expand Up @@ -4114,8 +4114,8 @@ handoff logging completion to the BuildManager.
submission1.ExecuteAsync(null, null);
submission2.ExecuteAsync(null, null);

submission1.WaitHandle.WaitOne(TimeSpan.FromSeconds(10));
submission2.WaitHandle.WaitOne(TimeSpan.FromSeconds(10));
submission1.WaitHandle.WaitOne(TimeSpan.FromSeconds(20));
submission2.WaitHandle.WaitOne(TimeSpan.FromSeconds(20));

submission1.IsCompleted.ShouldBeTrue();
submission2.IsCompleted.ShouldBeTrue();
Expand Down

0 comments on commit 56cb905

Please sign in to comment.