简体   繁体   中英

Long R system call hangs

I would greatly appreciate some help with the following:

I am simply running 3 instances of a standalone app from R in foreach in parallel. Please see the mock code below:

require("foreach")
require("doMC")

registerDoMC(cores=3)
foreach(sample=1:9) %dopar%{
        system2(command="app", args=c("some","args"), 
                stdout = NULL, stderr = NULL) 
}

Regardless of whether I use system , system2 , in the task manager I can see:

  1. rsession (parent)
  2. 3x rsessions (from foreach)
  3. 3x app (processes)

The problem is: parent uses a lot of CPU and keeps consuming RAM until I fall into swap. This happens for any app , any number of threads in foreach and essentially, any system call from R, which runs longer than some negligible times hangs and never returns.

My machine has Debian Jessie and R 3.2.3.

Thank you in advance!

Ok, I have found what was causing the problem: RStudio. The rsession parent thing was likely scanning for file changes and stalling somewhere until the process finishes. Running R from console displays no such problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM