Skip to content
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

Build hangs when sub-process errors out #78

Closed
patearl opened this issue Sep 27, 2018 · 5 comments
Closed

Build hangs when sub-process errors out #78

patearl opened this issue Sep 27, 2018 · 5 comments

Comments

@patearl
Copy link

patearl commented Sep 27, 2018

When it sets up the pipe logger and then runs the sub-process, the inner process can fail and then the outer loop sits there waiting in the Read() forever. There should be some sort of error reported if the inner process fails (for example, due to missing required assemblies). Right now no errors are reported and the Build() call just never returns.

@patearl
Copy link
Author

patearl commented Sep 27, 2018

I know little about what is going on, but I wonder if the reason it doesn't return due to the pipe being closed is that the pipe never "opened" so it never gets a subsequent close event. It just waits forever for the sub-process to open, even though it failed out right away.

@daveaglick
Copy link
Collaborator

Good catch. I can see why it's happening, and I can replicate just by removing the MSBuild logger when calling MSBuild (in which case the build finishes and the process exits but the pipe never attached).

The tricky thing here is what to do in this case. netstandard doesn't have Thread.Abort() so I can't kill the pipe server thread even if I wanted to (and Thread.Abort() isn't great anyway). The upstream code that reads the pipe stream is blocking for data, but doesn't take a CancellationToken so I can't signal it to stop either. May need to attach and then close a dummy pipe client in this case...let me try some things. In either case, should have an update out to fix this in a bit.

@patearl
Copy link
Author

patearl commented Sep 27, 2018

When it does error out, we would like to see the contents of the error message. I believe it's been output to stderr but not being collected by the process runner.

We are debating whether to release internally or wait for your release since we are on a tight timeline. In any case, I want to say thanks for this lifesaving tool!

@daveaglick
Copy link
Collaborator

Turns out this was a little more complicated than I gave it credit for. Pipe synchronization turns out to be pretty challenging. I think I've got it resolved with 2.0.1 though, take it for a spin and let me know if you're still having hangs and we'll re-open the issue.

@patearl
Copy link
Author

patearl commented Sep 27, 2018

The hanging problem is now gone! Thanks! The error message from the inner build is not yet reported. I opened another issue to address that one. Thankfully that one is a quick fix.

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

No branches or pull requests

2 participants