-
Notifications
You must be signed in to change notification settings - Fork 842
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
Replace runghc with ghc -e Main.main #2474
Conversation
Motivation: if you call `runghc`, that process continues to live on separate from the actual `ghc` process that interprets the code. That's inefficient. But more worryingly: the `runghc` process itself can cause major problems in Docker images, since it ends up swallowing SIGINTs as the PID-1 process. This was discussed quite a bit on Twitter: https://twitter.com/argumatronic/status/763418990982991872
Copied from Slack: This is a good change no matter what. That said, for the Docker case, maybe we should go back to having a separate 'init' process. We used to use phusion/baseimage's my_init in the containers but eliminated that for faster startup and compatibility with non-FP Complete-generated images. At that time we considered whether we should introduce our own extra 'init' process but decided to try without and see how it went. Up to this issue, it doesn't seem to have caused any problems but now here's a case where it did. |
Also copied from Slack: In the case that I ran into, I wasn't actually launching the Docker image with Stack, so it wouldn't be relevant. |
Know this is semi-OT but:
But Docker's initless containers will have the same issues with signal handling. Have you considered using https://github.com/krallin/tini? If there's interest I can split an issue for this. |
Makes sense to me! |
I ended up using dumb-init to solve the problem, which is the same concept On Fri, Aug 12, 2016, 3:10 AM Michael Sloan [email protected]
|
With this fix we lost the ability to pass arguments to scripts. One possible fix is to use:
Or to revert to using |
That's a good catch, I didn't realize that's how |
Ok, I will revert back to using runghc then. |
Thanks, sorry for the breakage. Going forward, we can consider either:
On Tue, Aug 16, 2016 at 4:58 PM, Harendra Kumar [email protected]
|
Well, it seems But there are a bit more issues which
Though its trivial to take care of all of them except interpreting stdin. Still it may be a good idea to use |
To be sure: you're talking just about inefficiency, not signal handling (for which we need a real init, see #2498), right? If so, I agree on approach n. 2. |
Yeah I guess there is no other general way for proper signal handling other than using a tailor made process. I think we need to keep the parent runghc process around to cleanup the temporary file that runghc creates to interpret stdin. Though it may be possible to use delete-on-close to clean up the temp file automatically even without keeping the parent around. In the non-stdin case there is no reason for the parent to be around. So I think in both cases we could do with one process instead of two. I think this optimization is a nice to have and could be useful only when we are running out of process slots or using too many of them. Not sure if it has any use in this particular use case, definitely not for performance. |
Motivation: if you call
runghc
, that process continues to live onseparate from the actual
ghc
process that interprets the code. That'sinefficient. But more worryingly: the
runghc
process itself can causemajor problems in Docker images, since it ends up swallowing SIGINTs as
the PID-1 process. This was discussed quite a bit on Twitter:
https://twitter.com/argumatronic/status/763418990982991872