-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix possible ToolTask hang #10297
Fix possible ToolTask hang #10297
Conversation
…child process is keeping the MSBuild waiting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember how you mentioned this offline and said "I bet Rainer will ask for {some wise thing to ask}"?
. . . let's assume I ask for that :-P
(Was it a wait-for-flush situation? I don't know if there's a great way to do that. Maybe just putting this behind a changewave would be sufficient?)
Co-authored-by: Rainer Sigwald <raines@microsoft.com>
I remember that when I analyzed the problem, the issue of WaitForExit(int) is that it doesn't wait for the pipes to empty. I'm not sure, but I think it can lead to the end of the output to be truncated. |
I think I'm running into this issue after this PR: #10378 |
There could be a work around using some reflection hack, but without that there is no way to wait for exit cleanly on windows. Ideally the underlying bug should be fixed: dotnet/runtime#51277 |
Fixes #2981
and probably #10286
Context
ToolTask
can hang when child process spawns a grandchild process that doesn't exit.Changes Made
Using different overload of
WaitForExit
to avoid situation when grandchild process is keeping the MSBuild waiting.See dotnet/runtime#51277 and #2981 (comment)
Testing
Manual testing with custom
ToolTask
implementation. This tasks starts process that starts another process with longer lifetime.Notes