-
Notifications
You must be signed in to change notification settings - Fork 38
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
on.exit() callbacks do not run when r() receives SIGINT #99
Comments
Processx kills the child process on interrupt.
|
It is also not worth sending a SIGINT, because R often ignores that. |
Fair enough, thanks @gaborcsardi. I will explore workarounds. |
So if your goal is to simply clean up the whole process tree, callr does not use it currently, but it should. |
Yes, my goal is to clean up the whole process tree. Would you be open to a pull request that adds a formal |
I think they should just forward |
Hmm... I think I misspoke. For this to improve ropensci/drake#772, I think I would need HPC jobs to be connected to the local process tree through handlers that respect SIGINT. |
Well, if you are sure that your R code respects SIGINT (e.g. it does not have compiled code), then you can start an R subprocess in the background with Note that on windows there is no SIGINT, but you can still use |
@gaborcsardi Shouldn't this be up the the code executed by However, if Would you consider sending |
Well, not really, because R itself installs a handler. This handler does a clean interrupt, and in non-interactive mode also exits. But in compiled code it ignores interrupts, unless the compiled code explicitly checks for them. Removing the default handler and installing another one is not sg I would recommend, and AFAIR R reinstalls its handler frequently, anyway, so might not be even possible.
I suppose I could do that, although this is not trivial, because of pid reuse, and I also don't see how it helps the original issue, because you can't implement reliable cleanup on top of this. |
I was more thinking about a handler via R and less about an C-level signal handler. So for instance: callr::r({
tryCatch({ something that mounts a resource }, interrupt=function(e) unmount(resource))
}) As far as I understand, this would clean up its resources upon
I'm not sure I understand this. Or if sticking with |
Reprex: mschubert/clustermq#130 (comment)
The text was updated successfully, but these errors were encountered: