-
Notifications
You must be signed in to change notification settings - Fork 86
on Windows, waitForProcess
hangs forever on certain git
commands
#273
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
Comments
Pinging @Mistuke if you have any thoughts on this. |
Sure I can take a look. Just to check, is this msys2 git or native windows git? I'm currently looking at a similar issue in cabal where it's looking like the finalizers aren't run, so the resource is never released and the child process becomes zombie. I have been unable to reproduce it myself so hopefully I can with this. |
@Mistuke I think native? But I'm not sure what the proper way to find out is |
If you can't reproduce it and I can help in any other way, let me know |
Ah basically did you install it through |
@Mistuke I appear to have installed it via https://gitforwindows.org/ |
Ah great, that's native then. I'll dig in in a bit, will let you know if I need a system call trace. :) |
Ok, I have been able to reproduce it, and I think that main :: IO ()
main = do
for_ processes $ \cp -> withCreateProcess cp $ \_ _ _ p -> do
waitForProcess p >>= print is... an interesting dichotomy.. when using However the NT kernel only releases the process when the last However this use-case is not unreasonable, so question is how to support it. @snoyberg would you agree that the semantics of That is to say, I think I'm allowed to close the process |
I don't think that's true in general. I'm not as familiar with the Windows process API (though I'm not a stranger to it), but it's a pretty common thing in my experience to, for example:
|
That scenario should be fine though, what I'm asking is essentially, that after the process has exited, so after the main thread returns from waiting for the process exit, whether there's any expectation that the PID is still valid. I would have expected no since the program terminated. Of course you can still drain the data handles, but with the PID only getting the exit code seems valid. i.e. |
Then I misunderstood, sorry. I believe what you're saying is correct. My understanding of how the package operates is that once it sees that a PID has closed, it never uses it again. This is based on the Unix contracts around waitforpid, but I think the same logic applies on the Windows side. |
Sorry I have not forgotten about this. I have a fix for it but wanted to do some more verification in GHC before posting it. I've been busy with work but have set aside some time Saturday to finish checking and post the patch. |
#277 Fixes this. |
Encountered in this cabal issue: haskell/cabal#8688
Running the following script will successfully execute the first process, but then will get stuck indefinitely while waiting for the second process to finish. The program cannot be killed with Ctr+C, but can be killed from the task manager.
If the process is killed and the
git fetch
command is run manually, the program will succeed if it's run again.In WSL, the script ran successfully.
Reproduction steps:
Run the following script with
cabal run <filename>
:Environment:
The text was updated successfully, but these errors were encountered: