[Haskell-beginners] forkProcess behaviour

Michael Snoyman michael at snoyman.com
Wed Jul 25 08:23:25 UTC 2018


On Tue, Jul 24, 2018 at 10:05 AM PICCA Frederic-Emmanuel <
frederic-emmanuel.picca at synchrotron-soleil.fr> wrote:

> Hello
>
> I have done the first solution and call the program changing the command
> line in oder to execute each child task.
> It works well and I can change the uid gid of these process.
>
> > For the most part, yes. You may need to reach deeper and use SIGKILL
> occasionally, depending on how stubborn the child process is. The `timeout`
> will only kill off the parent thread's call to block on the child's exit
> code.
>
> Since all these tasks are executing also child process via other system
> cals.
> So I have a hyerarchy of process.
>
> Do you know how to manage that sort of things if something goes wrong and
> I need to kill the first child and all its children's ?
> Is it possible for CreateProcess to track all these process and kill them
> all  on request ?
>
>
Funnily enough, there's another discussion going on about this right now:

https://mail.haskell.org/pipermail/haskell-cafe/2018-July/129646.html

The basic answer is:

* You can create a process group and then kill the whole process group
* But a misbehaving program would still be able to escape it by creating
its own process group, only something like cgroups can be fully reliable
here


> > Yes, you should avoid forkProcess in this case, it will have
> unpredictable and confusing results.
>
> I take you advices seriously and now I start to build something (I hope)
> more robust.
>
> Thansk
>
> Frédéric
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20180725/01a67810/attachment.html>


More information about the Beginners mailing list