2

有时,我的 R 实例正在悄然死亡。我正在使用 foreach 进行并行处理。我正在使用 16 核和 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);}

我在“mkclog”日志文件中发现了以下错误。我在Error calling serialize R functionhttps://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)))

4

0 回答 0