msbuild icon indicating copy to clipboard operation
msbuild copied to clipboard

MSBuild Server fallback mechanism doesn't work when Mutex throws exception

Open MichalPavlik opened this issue 3 years ago • 0 comments

The MSBuildClientApp.TryLaunchServer method returns false in case server node couldn't be started (and build is then done without server). However, there was reported issue, when mutex logic failed with unhandled IOException.

Unhandled exception: System.IO.IOException: Connection timed out : 'Global\msbuild-server-launch-BSVTwDRbqiZ8pAK9bysU7lvA2UC4yhR_+Bc8sTbm8Jw'
         at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
         at Microsoft.Build.Experimental.MSBuildClient.TryLaunchServer()
         at Microsoft.Build.Experimental.MSBuildClient.Execute(CancellationToken cancellationToken)
         at Microsoft.Build.CommandLine.MSBuildClientApp.Execute(String[] commandLine, String msbuildLocation, CancellationToken cancellationToken)
         at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)
         at Microsoft.DotNet.Cli.Utils.MSBuildForwardingAppWithoutLogging.ExecuteInProc(String[] arguments)

Hotfix should be easy - insert mutex logic to existing try/catch block. We should also find out why is it time-outing.

https://github.com/dotnet/runtime/issues/75391 https://github.com/dotnet/runtime/issues/75867

MichalPavlik avatar Sep 21 '22 08:09 MichalPavlik