Executing the following code leaves 4 processes in the process table as zombies. These are created because the exit status of the child processes is never queried. library(parallel) library(doParallel) cl <- makeForkCluster(4) registerDoParallel(cl, cores = NUM.CORES) #...do something stopCluster(cl) These zombie processes are minor as they have released all resources, but it seems that either: (a) the stopCluster(...) call should check the status of the child processes or (b) the makeForkCluster(...) call should explicitly ignore SIGCHLD by setting its handler to SIG_IGN. As a workaround, (a) can be implemented by calling the wait() method of the fork package. e.g., library(fork) wait() wait() wait() wait() Removes the four zombie processes from the process table.
Note that this is reported by other users on StackOverflow as well http://stackoverflow.com/questions/9486952/remove-zombie-processes-using-parallel-package
Created attachment 1501 [details] updated mclapply function
Comment on attachment 1501 [details] updated mclapply function replacing "collect(children(jobs)...)" with "collect(jobs...) on line 17 fixes this issue for me.
The problem of zombies left behind by forking in "parallel" has been addressed in R-devel in 73775. 73775 very likely resolves also the issue reported here, yet it can't be easily tested as this report did not include a complete reproducible example (and the linked SO example did not leave a zombie on my system even in older versions of R). If you still see a zombie left behind in R newer than 73775 (but note that non-detached jobs have to be collected), please submit a new bug report with a complete, self-contained reproducible example that does not depend on external packages.