Computation continues after interruption of parallelised `future` workers in R
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 160
- Forks
- 69
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 15
Description
Describe the bug
I noticed that when doing parallel sampling from multiple (possibly different) STAN models within future workers and cancelling the execution of the main R script (the R parent process - in my case, using Ctrl+C in CLI mode), the STAN models and the children R processes will continue running as ghost processes. Appearently, something in the signal chain does not work. My guess is that although the signalling chain works well on the future side (this doesn't occur when no STAN model is running), the children R processes cannot stop as long as its children processes (= STAN process) are not stopped. I may be wrong though and this might be a bug in the future or foreach package, too.
To Reproduce
library(cmdstanr)
library(foreach)
library(doFuture)
plan(multisession,workers = 2)
foreach(i=1:2, .options.future = list(seed = TRUE), .inorder = F) %dofuture% {
// Add code for starting the sampling of a (fairly long-running) STAN model
// .. e.g. different(ly parameterised) models or data depending on i
}
Expected behavior
Same as when running STAN models directly: Interrupting the R script execution should immediately interrupt the sampling process.
Operating system
Ubuntu 22.04 LTS
CmdStanR version number
0.9.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided Ubuntu 22.04 reproduction using CmdStanR, foreach, doFuture, and a multisession plan, then trace interruption from the R parent through future workers to the STAN child processes. No source file or test is named; done means establishing the responsible signal-handling boundary and demonstrating that interrupting the parent stops all sampling and child processes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- distributed-systems, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100