Skip to content

Apparent compiler deadlock when compiling multiple separate projects in parallel #9187

@alexrp

Description

@alexrp

This is happening in Zig.Sdk, so this is easiest to reproduce if you're willing to install the .NET SDK.

Basically, do this:

$ git clone git@github.com:alexrp/zig-msbuild-sdk.git
$ dotnet build src/sdk
$ dotnet build src/samples -v:n -p:BuildInParallel=true

That last dotnet build invocation will sometimes hang. So far, it always seems to happen either when building two executables or two dynamic libraries at the same time; building an executable and a dynamic library at the same time appears to be fine. But this might be a red herring.

Attempting to cancel the build...
     5>C:\Users\alex\source\repos\zig-msbuild-sdk\pkg\cache\zig.sdk\1.0.1-dev.g5da2354e66\build\Zig.Sdk.Build.targets(7,9): warning MSB5021: Terminating the task executable "zig" and its child processes because the build was canceled. [C:\Users\alex\source\repos\zig-msbuild-sdk\src\samples\clib\clib.cproj]
     3>C:\Users\alex\source\repos\zig-msbuild-sdk\pkg\cache\zig.sdk\1.0.1-dev.g5da2354e66\build\Zig.Sdk.Build.targets(7,9): warning MSB5021: Terminating the task executable "zig" and its child processes because the build was canceled. [C:\Users\alex\source\repos\zig-msbuild-sdk\src\samples\cxxlib\cxxlib.cxxproj]
Attempting to cancel the build...
     5>C:\Users\alex\source\repos\zig-msbuild-sdk\pkg\cache\zig.sdk\1.0.1-dev.g5da2354e66\build\Zig.Sdk.Build.targets(7,9): warning MSB5021: Terminating the task executable "zig" and its child processes because the build was canceled. [C:\Users\alex\source\repos\zig-msbuild-sdk\src\samples\cxxlib\cxxlib.cxxproj]
     7>C:\Users\alex\source\repos\zig-msbuild-sdk\pkg\cache\zig.sdk\1.0.1-dev.g5da2354e66\build\Zig.Sdk.Build.targets(7,9): warning MSB5021: Terminating the task executable "zig" and its child processes because the build was canceled. [C:\Users\alex\source\repos\zig-msbuild-sdk\src\samples\clib\clib.cproj]
Attempting to cancel the build...
     2>C:\Users\alex\source\repos\zig-msbuild-sdk\pkg\cache\zig.sdk\1.0.1-dev.g5da2354e66\build\Zig.Sdk.Build.targets(7,9): warning MSB5021: Terminating the task executable "zig" and its child processes because the build was canceled. [C:\Users\alex\source\repos\zig-msbuild-sdk\src\samples\cexe\cexe.cproj]
     3>C:\Users\alex\source\repos\zig-msbuild-sdk\pkg\cache\zig.sdk\1.0.1-dev.g5da2354e66\build\Zig.Sdk.Build.targets(7,9): warning MSB5021: Terminating the task executable "zig" and its child processes because the build was canceled. [C:\Users\alex\source\repos\zig-msbuild-sdk\src\samples\cxxexe\cxxexe.cxxproj]

Note: Zig.Sdk normally fetches the Zig compiler (0.8.0) from NuGet but it can be overridden to use a local build by doing dotnet build src/samples -v:n -p:BuildInParallel -p:ZigExePath="path/to/zig". Also, I've seen this happen on all platforms (not just Windows) in CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions