Conversation
# Conflicts: # src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs
There was a problem hiding this comment.
🟡 Changes recommended
The updated header-read loop reads from _pipeStream while the body reads from _readStream (possibly buffered), which can desynchronize the stream and corrupt packet framing.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR aims to improve robustness of out-of-proc node IPC on Unix-like platforms (notably FreeBSD) by ensuring packet headers are fully read before processing, avoiding failures caused by partial reads.
Changes:
- Update the async packet read loop to read the full packet header in a loop rather than assuming a single
ReadAsyncreturns all bytes.
File summaries
| File | Description |
|---|---|
| src/Build/BackEnd/Components/Communications/NodeProviderOutOfProcBase.cs | Makes packet header reads resilient to partial ReadAsync results in the out-of-proc node communications loop. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
Add regression coverage for partial-header reads and EOF handling.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
| while (totalBytesRead < _headerByte.Length) | ||
| { | ||
| int bytesRead = await _readStream.ReadAsync(_headerByte.AsMemory(totalBytesRead, _headerByte.Length - totalBytesRead), CancellationToken.None).ConfigureAwait(false); |
This should fix #12944 - at least under my testing under FreeBSD 15 it enabled to complete the dotnet build. Recent builds under 15 are failing due to IPC communication errors, which this PR address.
The change followed the code pattern used in other places, which handle packet read in proper way. It was propoed to use ReadExactly, but I didn't saw any async versions/more usage in the code base, so simple loop was used.