dotnet / dotnet/msbuild

Hang when child process exits without writing to IPC pipe

Open
#860 0 comments 0 reactions 0 assignees View on GitHub
Area: IPC needs-design triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

After MSBuild starts a child/worker process, it [tries to handshake](https://github.com/Microsoft/msbuild/blob/d1bdd68a3f2b1eec2e9a17ec62ebe70c59e9019b/src/XMakeBuildEngine/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs#L412-L416) with the newly-created node by writing to an IPC pipe and waiting for the handshake response.

If process creation fails, an error is propagated upward and MSBuild doesn't hang. If, however, process creation succeeds but the child quickly terminates instead of waiting for the handshake, the indefinite blocking read on handshake response turns into a mysterious MSBuild hang.

We should either have a timeout for handshake success, or at the very least fail early in `WaitForConnectionFromProcess` if the `nodeProcessId` doesn't belong to a running process.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked handshake code in src/XMakeBuildEngine/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs, especially WaitForConnectionFromProcess and the read after the IPC-pipe write. Trace what happens when the child exits before replying. Done means MSBuild fails early or times out instead of hanging indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.