-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Unix: add support for PR_SET_PDEATHSIG #10515
Comments
Note: the Since 4.12, |
Hi @xavierleroy, as far as I understand, the The OCaml function can expose an additional (optional) argument, a This way we will have all the keys to easily define our own initialization function and call I can take a closer look and open a merge request if you want? |
Maybe there's a misunderstanding or two. First, the For the Glibc/Linux implementation of The other possible misunderstanding is the reasons why OCaml moved away from implementations of |
You are right, I should have read more carefully the
It would be nice, yeah. I think I will follow your advice and open a request to Glibc developers. You can close this issue for now, I will come back to you if there are some interesting moves. |
You're welcome. The traditional way to kill all child processes when the parent is killed relies on process groups and a monitoring program. See for example the timeout command from GNU coreutils. Maybe this would give a more portable solution to your problem. |
Hi,
I'll take the example of binsec that often call external SMT solver session with pipe communication (e.g.
Unix.open_process
).After long running sessions, the main process may be killed by the OOM Process Killer, leaving the waiting or running SMT solver sessions open.
On linux, the problem can be addressed by sending a signal to the child process on the parent death (e.g.
prctl(PR_SET_PDEATHSIG, SIGKILL);
).However, to make it work in OCaml, we need both to write a
C
stub and to manually rewrite all the spawning function to executeprctl
after the fork but before theexec*
. This shares all but few lines ofunix.ml
code and it is not a good development practice (moreover, I am not really sure how the license act in such case).Thus, I think it is preferable that the
Unix
module offers some facilities for theopen_process_*
functions to set this signal, either by:?pdeathsig:int
(principled solution);fork
, but before theexec*
(generic approach).Do you think such thing can be added?
Regards,
The text was updated successfully, but these errors were encountered: