-
Notifications
You must be signed in to change notification settings - Fork 82
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
Deadlock on Windows Server 2012 when passing same pipe for stdout and stderr #76
Comments
It looks like you've left the opposite ends of the pipe open. Can you try setting |
It still hangs in this situation (though you are right that close_fds helps avoid deadlocks on Linux in other situations.) See https://ci.appveyor.com/project/ezyang/ghceye corresponding to ezyang/ghceye@799ebb3 (I also removed the passed in stdin because we can deadlock even if it's managed by the process itself.) Empirically, it also seems to be the case that if you don't feed stdin into the subprocess, the deadlock doesn't occur. |
I've added more debugging output, which yields something very interesting: this is blocked on the |
OK, I accidentally fixed the bug, and believe I understand why your original program failed. If you look at this commit: I changed things such that the output is read in a separate thread. My theory is that on Windows Server 2012, the process is not exiting because it is still attempting to write some data to its stdout, but the buffer is full. The buffer will not be emptied until we get This looks like valid behavior in the process package to me, and an example of it being difficult to use the process API safely without concurrency. |
Hmm. While that it progress, I think there a few unexplained things:
|
|
In the meantime, here are some references for how to implement non-blocking waitpid: https://ldpreload.com/blog/signalfd-is-useless https://github.com/ravinet/mahimahi/blob/master/src/util/event_loop.cc#L25 |
The following Haskell program, built with GHC 8.0.1, deadlocks on Windows Server 2012:
You can reproduce the error on AppVeyor with the following repository: https://github.com/ezyang/ghceye (appveyor.yml included).
It does not appear to deadlock on Windows 10 or Linux. I have not attempted to reproduce on a local install of Windows Server 2012. I tried this similar Python code which did not deadlock, which is why I believe it to be a bug in the process library:
The text was updated successfully, but these errors were encountered: