有时,我的R实例正在静默死亡。我正在使用foreach进行并行处理。我正在使用16core和64GB ram机器。我正在使用以下代码来执行foreach。
cl <- makeCluster(6,outfile=mkclog);
registerDoParallel(cl, cores = detectCores())
ex <- Filter(function(x) is.function(get(x, .GlobalEnv)), ls(.GlobalEnv))
clusterExport(cl, ex)
foreach(l=1:nrow(ISDD),.combine=c,.packages=c("stringr","DBI","rJava","aspace","Hmisc","xts","log4r","codetools","lattice","Rcpp","plyr","memoise","digest","zoo","RMySQL","lubridate","foreach","parallel","doParallel","RJDBC")) %dopar%
{foreachfun(i,l,IDS,LIDS,LFLAG,RFlag,logger,SExp,Fflag,ISDD,EXPALL);}
我在&#34; mkclog&#34;中找到了以下错误日志文件。我在Error calling serialize R function和https://github.com/stan-dev/rstan/issues/243发现了同样的错误。工人死亡导致退出现有的R会话。有没有解决方案?
23: foreachfun(i, l,IDS, LIDS, LFLAG, RFlag, logger, SExp, Fflag, ISDD, EXPALL)
24: eval(expr, envir, enclos)
25: eval(.doSnowGlobals$expr, envir = .doSnowGlobals$exportenv)
26: doTryCatch(return(expr), name, parentenv, handler)
27: tryCatchOne(expr, names, parentenv, handlers[[1L]])
28: tryCatchList(expr, classes, parentenv, handlers)
29: tryCatch(eval(.doSnowGlobals$expr, envir = .doSnowGlobals$exportenv), error = function(e) e)
30: (function (args) { lapply(names(args), function(n) assign(n, args[[n]], pos = .doSnowGlobals$exportenv)) tryCatch(eval(.doSnowGlobals$expr, envir = .doSnowGlobals$exportenv), error = function(e) e)})(quote(list(l = 8L)))
31: do.call(msg$data$fun, msg$data$args, quote = TRUE)
32: doTryCatch(return(expr), name, parentenv, handler)
33: tryCatchOne(expr, names, parentenv, handlers[[1L]])
34: tryCatchList(expr, classes, parentenv, handlers)
35: tryCatch(do.call(msg$data$fun, msg$data$args, quote = TRUE), error = handler)
36: doTryCatch(return(expr), name, parentenv, handler)
37: tryCatchOne(expr, names, parentenv, handlers[[1L]])
38: tryCatchList(expr, classes, parentenv, handlers)
39: tryCatch({ msg <- recvData(master) if (msg$type == "DONE") { closeNode(master) break } else if (msg$type == "EXEC") { success <- TRUE handler <- function(e) { success <<- FALSE structure(conditionMessage(e), class = c("snow-try-error", "try-error")) } t1 <- proc.time() value <- tryCatch(do.call(msg$data$fun, msg$data$args, quote = TRUE), error = handler) t2 <- proc.time() value <- list(type = "VALUE", value = value, success = success, time = t2 - t1, tag = msg$data$tag) sendData(master, value) }}, interrupt = function(e) NULL)
40: slaveLoop(makeSOCKmaster(master, port, timeout, useXDR))
41: parallel:::.slaveRSOCK()
aborting ...
Error in unserialize(node$con) : error reading from connection
Calls: <Anonymous> ... doTryCatch -> recvData -> recvData.SOCKnode -> unserialize
Execution halted
Error in unserialize(node$con) : error reading from connection
Calls: <Anonymous> ... doTryCatch -> recvData -> recvData.SOCKnode -> unserialize
Execution halted
Error in unserialize(node$con) : error reading from connection
Calls: <Anonymous> ... doTryCatch -> recvData -> recvData.SOCKnode -> unserialize
Execution halted
我怀疑30: (function (args) { lapply(names(args), function(n) assign(n, args[[n]], pos = .doSnowGlobals$exportenv)) tryCatch(eval(.doSnowGlobals$expr, envir = .doSnowGlobals$exportenv), error = function(e) e)})(quote(list(l = 8L)))