Skip to content

Fix deadlock if an MSBuild task is writing to stdout #78927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

jasonmalinowski
Copy link
Member

When we switched over to communicating over a named pipe rather than stdin/stdout, we were still redirecting stdin and stdout. This had the side effect that if a build task was directly writing to standard out, the build would eventually deadlock since we weren't reading from the other side.

I thought about simply not redirecting stdin/stdout, but I could imagine other problems might come up if we were to have multiple build hosts trying to share stdin/stdout. So now we'll log stdout the same way we log stderr, and explicitly close stdin so readers won't deadlock waiting for input.

Fixes #78766

@jasonmalinowski jasonmalinowski self-assigned this Jun 12, 2025
@jasonmalinowski jasonmalinowski requested a review from a team as a code owner June 12, 2025 00:06
When we switched over to communicating over a named pipe rather than
stdin/stdout, we were still redirecting stdin and stdout. This had
the side effect that if a build task was directly writing to standard
out, the build would eventually deadlock since we weren't reading from
the other side.

I thought about simply not redirecting stdin/stdout, but I could imagine
other problems might come up if we were to have multiple build hosts
trying to share stdin/stdout. So now we'll log stdout the same way
we log stderr, and explicitly close stdin so readers won't deadlock
waiting for input.

Fixes dotnet#78766
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

workspace.OpenSolutionAsync locked after update code analysis libraries on vs 17.14
3 participants