-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Frozen program when using a calling a system program with backticks #5236
Comments
Replacing the
|
Does removing the forks fix it? We should probably just remove fork entirely. It won't work properly on windows anyway. |
Just tested, removing the forks does fix the hang issue. |
Indeed, removing the fork lets it complete. The following simpler snippet reproduces it on my system:
|
Or even simpler:
Note, if you fork something which completes (like |
Seems like forking messes up libevent's signal handler internal state somehow, which means the SIGCHLD event required for As I said, we'll probably remove fork. What's your usecase for it. |
@bew the |
My use case is that I was porting ruby code over and took advantage of the fact that fork existed. What alternative to fork do you recommend? |
Huh, looks like #1454 may be the same as this:
|
Switching to spawn works for me in this case. |
Not compatible with Windows isn't a good reason to drop support for something ubiquitous and expected on every-single-other platform. IMHO the issue lies in how we handle signals. We don't use libevent and rely on a custom solution (bad idea). Why signals? Because Process uses the SIGCHLD signal to detect that a child process has terminated. |
I filed #5240 earlier and it may be slightly related. In that case, `` in a signal handler causes the program to freeze. |
Can recreate on
OS : It seems that calling the `` before the forking is the problem
Some times i get the following error
|
Does it still reproduce with crystal master? I recently changed a few things in signal handling, which affects Process#wait. |
Yes, can reproduce with master
|
All examples work for me now 🎉
|
Lets close then. |
Crystal 0.23.1 [e2a1389] (2017-07-13) LLVM 3.8.1
Ubuntu 17.04
The following code will not finish on my machine:
It always hangs after a few of the sleep calls. HOWEVER, if I comment out the line "current =
ls
", it works.Contrived example, but I think it demonstrates the problem.
Thoughts?
The text was updated successfully, but these errors were encountered: