R Under development (unstable) (2024-03-25 r86192 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > source("incl/start.R") [17:26:10.383] plan(): Setting new future strategy stack: [17:26:10.385] List of future strategies: [17:26:10.385] 1. sequential: [17:26:10.385] - args: function (..., envir = parent.frame(), workers = "") [17:26:10.385] - tweaked: FALSE [17:26:10.385] - call: future::plan("sequential") [17:26:10.401] plan(): nbrOfWorkers() = 1 > options(future.debug = FALSE) > message("*** cluster() ...") *** cluster() ... > > message("Library paths: ", paste(sQuote(.libPaths()), collapse = ", ")) Library paths: 'D:/temp/RtmpAVtqMV/RLIBS_30708245f64e7', 'D:/RCompile/recent/R/library' > message("Package path: ", sQuote(system.file(package = "future"))) Package path: 'D:/RCompile/CRANincoming/R-devel/lib/future' > > types <- "PSOCK" > > ## Speed up CRAN checks: Skip on CRAN Windows 32-bit > if (isWin32) types <- NULL > > if (supportsMulticore() && !on_solaris) types <- c(types, "FORK") > > ## WORKAROUND: covr::package_coverage() -> merge_coverage() -> ... produces > ## "Error in readRDS(x) : error reading from connection" for type = "FORK". > ## Is this related to mcparallel() comments in help("package_coverage")? > ## /HB 2017-05-20 > if (covr_testing) types <- setdiff(types, "FORK") > > ## WORKAROUND: FORK:ed processing gives really odd type="FORK" results on > ## macOS when running on GitHub Actions. /HB 2020-06-07 > ## This error is also appearing on CRANs' 'r-release-macos-arm64' and > ## 'M1mac' checks. /HB 2021-08-11 > if (on_macos) types <- setdiff(types, "FORK") > > pid <- Sys.getpid() > message("Main PID (original): ", pid) Main PID (original): 152708 > cl <- NULL > for (type in types) { + message(sprintf("Test set #1 with cluster type %s ...", sQuote(type))) + + message("Main PID (original): ", pid) + + for (cores in 1:availCores) { + message(sprintf("Testing with %d cores on type = %s ...", + cores, sQuote(type))) + options(mc.cores = cores) + + ## Set up a cluster with nodes (explicitly) + cl <- parallel::makeCluster(cores, type = type, timeout = 60) + print(cl) + + plan(cluster, workers = cl) + + ## Assert that the worker's global environment is "empty" + f <- future(ls(envir=globalenv(), all.names=TRUE)) + v <- value(f) + v <- grep("^[.][.][.]future[.]", v, invert = TRUE, value = TRUE) + if (length(v) > 0) { + stop(sprintf("Stray variables in the global environment of %s: %s", + class(f)[1], paste(sQuote(v), collapse = ", "))) + } + + ## No global variables + f <- try(cluster({ + 42L + }, workers = cl), silent = FALSE) + print(f) + stopifnot(inherits(f, "ClusterFuture")) + + print(resolved(f)) + y <- value(f) + print(y) + stopifnot(y == 42L) + + ## No global variables + f <- try(cluster({ + 42L + }, workers = cl), silent = FALSE) + print(f) + stopifnot(inherits(f, "ClusterFuture")) + + print(resolved(f)) + y <- value(f) + print(y) + stopifnot(y == 42L) + + ## A global variable + a <- 0 + f <- try(future({ + b <- 3 + c <- 2 + a * b * c + })) + print(f) + + + ## A cluster future is evaluated in a separate + ## R session process. Changing the value of a global + ## variable should not affect the result of the + ## future. + a <- 7 ## Make sure globals are frozen + v <- value(f) + print(v) + stopifnot(v == 0) + + if (!"covr" %in% loadedNamespaces()) { + message("*** cluster() with globals and blocking") + fs <- list() + for (ii in 1:3) { + message(sprintf(" - Creating cluster future #%d ...", ii)) + fs[[ii]] <- future({ ii }, label = sprintf("future-%d", ii)) + } + message(sprintf(" - Resolving %d cluster futures", length(fs))) + v <- sapply(fs, FUN = value) + stopifnot(all(v == 1:3)) + } + + + message("*** cluster() and errors") + f <- future({ + stop("Whoops!") + 1 + }) + print(f) + v <- value(f, signal = FALSE) + print(v) + stopifnot(inherits(v, "simpleError")) + + res <- tryCatch(value(f), error = identity) + print(res) + stopifnot(inherits(res, "error")) + + ## Error is repeated + res <- tryCatch(value(f), error = identity) + print(res) + stopifnot(inherits(res, "error")) + + ## Custom error class + f <- future({ + stop(structure(list(message = "boom"), + class = c("MyError", "error", "condition"))) + }) + print(f) + v <- value(f, signal = FALSE) + print(v) + stopifnot(inherits(v, "error"), inherits(v, "MyError")) + + ## Make sure error is signaled + res <- tryCatch(value(f), error = identity) + stopifnot(inherits(res, "error"), inherits(res, "MyError")) + + message("*** cluster() - too large globals ...") + ooptsT <- options(future.globals.maxSize = object.size(1:1014)) + + limit <- getOption("future.globals.maxSize") + cat(sprintf("Max total size of globals: %g bytes\n", limit)) + + ## A large object + a <- 1:1014 + yTruth <- sum(a) + size <- object.size(a) + cat(sprintf("a: %g bytes\n", size)) + f <- future({ sum(a) }) + print(f) + rm(list = "a") + v <- value(f) + print(v) + stopifnot(v == yTruth) + + + ## A too large object + a <- 1:1015 + yTruth <- sum(a) + size <- object.size(a) + cat(sprintf("a: %g bytes\n", size)) + res <- tryCatch(f <- future({ sum(a) }), error = identity) + rm(list = "a") + stopifnot(inherits(res, "error")) + + ## Undo options changed in this test + options(ooptsT) + + message("*** cluster() - too large globals ... DONE") + + message("*** cluster() - installed libraries ...") + f <- try(cluster({ + list( + libPaths = .libPaths() + ) + }, workers = cl), silent = FALSE) + print(f) + stopifnot(inherits(f, "ClusterFuture")) + v <- value(f) + message(paste(capture.output(str(v)), collapse = "\n")) + message("*** cluster() - installed packages ... DONE") + + + message("*** cluster() - assert covr workaround ...") + f <- try(cluster({ + future:::hpaste(1:100) + }, workers = cl), silent = FALSE) + print(f) + stopifnot(inherits(f, "ClusterFuture")) + v <- value(f) + message(v) + stopifnot(v == hpaste(1:100)) + message("*** cluster() - assert covr workaround ... DONE") + + ## Assert that the worker's global environment is "empty" + f <- future(ls(envir=globalenv(), all.names=TRUE)) + v <- value(f) + v <- grep("^[.][.][.]future[.]", v, invert = TRUE, value = TRUE) + if (length(v) > 0) { + stop(sprintf("Stray variables in the global environment of %s: %s", + class(f)[1], paste(sQuote(v), collapse = ", "))) + } + + ## Sanity checks + pid2 <- Sys.getpid() + message("Main PID (original): ", pid) + message("Main PID: ", pid2) + stopifnot(pid2 == pid) + + ## Cleanup + parallel::stopCluster(cl) + + message(sprintf("Testing with %d cores on type = %s ... DONE", + cores, sQuote(type))) + } ## for (cores ...) + + message("*** cluster() - exceptions ...") + + res <- tryCatch(cluster(42L, workers = NA), error = identity) + print(res) + stopifnot(inherits(res, "error")) + + message("*** cluster() - exceptions ... DONE") + + message("*** cluster() - assert registry behavior ...") + + ## Explicitly created clusters are *not* added to the registry + cl <- parallel::makeCluster(1L, type = type, timeout = 60) + plan(cluster, workers = cl) + clR <- ClusterRegistry("get") + stopifnot(is.null(clR)) + + ## ... and therefore changing plans shouldn't change anything + plan(sequential) + clR <- ClusterRegistry("get") + stopifnot(is.null(clR)) + + ## Cleanup + print(cl) + str(cl) + parallel::stopCluster(cl) + + message("*** cluster() - assert registry behavior ... DONE") + + ## Sanity checks + pid2 <- Sys.getpid() + message("Main PID (original): ", pid) + message("Main PID: ", pid2) + stopifnot(pid2 == pid) + + ## Cleanup + plan(sequential) + + cl1 <- parallel::makeCluster(1L, type = type, timeout = 60) + plan(cluster, workers = cl1) + f1 <- future(1) + + ## Cleanup + print(cl1) + str(cl1) + parallel::stopCluster(cl1) + + message(sprintf("Test set #1 with cluster type %s ... DONE", sQuote(type))) + } ## for (type ...) Test set #1 with cluster type 'PSOCK' ... Main PID (original): 152708 Testing with 1 cores on type = 'PSOCK' ... socket cluster with 1 nodes on host 'localhost' ClusterFuture: Label: '' Expression: { 42L } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' [1] TRUE [1] 42 ClusterFuture: Label: '' Expression: { 42L } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' [1] TRUE [1] 42 ClusterFuture: Label: '' Expression: { b <- 3 c <- 2 a * b * c } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 1 objects totaling 56 bytes (numeric 'a' of 56 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' [1] 0 *** cluster() with globals and blocking - Creating cluster future #1 ... - Creating cluster future #2 ... - Creating cluster future #3 ... - Resolving 3 cluster futures *** cluster() and errors ClusterFuture: Label: '' Expression: { stop("Whoops!") 1 } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' ClusterFuture: Label: '' Expression: { stop(structure(list(message = "boom"), class = c("MyError", "error", "condition"))) } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' *** cluster() - too large globals ... Max total size of globals: 4104 bytes a: 4104 bytes ClusterFuture: Label: '' Expression: { sum(a) } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 1 objects totaling 4.01 KiB (integer 'a' of 4.01 KiB) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' [1] 514605 a: 4112 bytes *** cluster() - too large globals ... DONE *** cluster() - installed libraries ... ClusterFuture: Label: '' Expression: { list(libPaths = .libPaths()) } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' List of 1 $ libPaths: chr [1:2] "D:/temp/RtmpAVtqMV/RLIBS_30708245f64e7" "D:/RCompile/recent/R/library" *** cluster() - installed packages ... DONE *** cluster() - assert covr workaround ... ClusterFuture: Label: '' Expression: { future:::hpaste(1:100) } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 *** cluster() - assert covr workaround ... DONE Main PID (original): 152708 Main PID: 152708 Testing with 1 cores on type = 'PSOCK' ... DONE Testing with 2 cores on type = 'PSOCK' ... socket cluster with 2 nodes on host 'localhost' ClusterFuture: Label: '' Expression: { 42L } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' [1] TRUE [1] 42 ClusterFuture: Label: '' Expression: { 42L } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' [1] TRUE [1] 42 ClusterFuture: Label: '' Expression: { b <- 3 c <- 2 a * b * c } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 1 objects totaling 56 bytes (numeric 'a' of 56 bytes) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' [1] 0 *** cluster() with globals and blocking - Creating cluster future #1 ... - Creating cluster future #2 ... - Creating cluster future #3 ... - Resolving 3 cluster futures *** cluster() and errors ClusterFuture: Label: '' Expression: { stop("Whoops!") 1 } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' ClusterFuture: Label: '' Expression: { stop(structure(list(message = "boom"), class = c("MyError", "error", "condition"))) } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' *** cluster() - too large globals ... Max total size of globals: 4104 bytes a: 4104 bytes ClusterFuture: Label: '' Expression: { sum(a) } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: 1 objects totaling 4.01 KiB (integer 'a' of 4.01 KiB) Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' [1] 514605 a: 4112 bytes *** cluster() - too large globals ... DONE *** cluster() - installed libraries ... ClusterFuture: Label: '' Expression: { list(libPaths = .libPaths()) } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' List of 1 $ libPaths: chr [1:2] "D:/temp/RtmpAVtqMV/RLIBS_30708245f64e7" "D:/RCompile/recent/R/library" *** cluster() - installed packages ... DONE *** cluster() - assert covr workaround ... ClusterFuture: Label: '' Expression: { future:::hpaste(1:100) } Lazy evaluation: FALSE Asynchronous evaluation: TRUE Local evaluation: TRUE Environment: R_GlobalEnv Capture standard output: TRUE Capture condition classes: 'condition' (excluding 'nothing') Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Resolved: TRUE Value: Conditions captured: Early signaling: FALSE Owner process: 9513fd6f-7713-1904-705b-f1563f6b1d58 Class: 'ClusterFuture', 'MultiprocessFuture', 'Future', 'environment' 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 *** cluster() - assert covr workaround ... DONE Main PID (original): 152708 Main PID: 152708 Testing with 2 cores on type = 'PSOCK' ... DONE *** cluster() - exceptions ... *** cluster() - exceptions ... DONE *** cluster() - assert registry behavior ... socket cluster with 1 nodes on host 'localhost' List of 1 $ :List of 3 ..$ con : 'sockconn' int 4 .. ..- attr(*, "conn_id")= ..$ host: chr "localhost" ..$ rank: num 0 ..- attr(*, "class")= chr "SOCKnode" - attr(*, "class")= chr [1:2] "SOCKcluster" "cluster" *** cluster() - assert registry behavior ... DONE Main PID (original): 152708 Main PID: 152708 socket cluster with 1 nodes on host 'localhost' List of 1 $ :List of 3 ..$ con : 'sockconn' int 4 .. ..- attr(*, "conn_id")= ..$ host: chr "localhost" ..$ rank: num 0 ..- attr(*, "class")= chr "SOCKnode" - attr(*, "class")= chr [1:2] "SOCKcluster" "cluster" Test set #1 with cluster type 'PSOCK' ... DONE > > library("parallel") > for (type in types) { + if (on_solaris) next + + message(sprintf("Test set #2 with cluster type %s ...", sQuote(type))) + + message("*** cluster() - setDefaultCluster() ...") + + cl <- makeCluster(1L, type = type, timeout = 60) + print(cl) + + setDefaultCluster(cl) + ## FIXME: Make plan(cluster, workers = NULL) work such that + ## setDefaultCluster() is actually tested. + plan(cluster) + + pid <- Sys.getpid() + message(pid) + + a %<-% Sys.getpid() + message(a) + + setDefaultCluster(NULL) + + ## Cleanup + print(cl) + str(cl) + parallel::stopCluster(cl) + + message("*** cluster() - setDefaultCluster() ... DONE") + + ## Sanity checks + pid2 <- Sys.getpid() + message("Main PID (original): ", pid) + message("Main PID: ", pid2) + stopifnot(pid2 == pid) + + ## Cleanup + plan(sequential) + + message(sprintf("Test set #2 with cluster type %s ... DONE", sQuote(type))) + } ## for (type ...) Test set #2 with cluster type 'PSOCK' ... *** cluster() - setDefaultCluster() ... socket cluster with 1 nodes on host 'localhost' 152708 162624 socket cluster with 1 nodes on host 'localhost' List of 1 $ :List of 3 ..$ con : 'sockconn' int 4 .. ..- attr(*, "conn_id")= ..$ host: chr "localhost" ..$ rank: num 0 ..- attr(*, "class")= chr "SOCKnode" - attr(*, "class")= chr [1:2] "SOCKcluster" "cluster" *** cluster() - setDefaultCluster() ... DONE Main PID (original): 152708 Main PID: 152708 Test set #2 with cluster type 'PSOCK' ... DONE > > ## Sanity checks > pid2 <- Sys.getpid() > message("Main PID (original): ", pid) Main PID (original): 152708 > message("Main PID: ", pid2) Main PID: 152708 > stopifnot(pid2 == pid) > > message("*** cluster() - exception when re-creating workers ...") *** cluster() - exception when re-creating workers ... > ## https://github.com/HenrikBengtsson/future/issues/261 > > plan(cluster, workers = "localhost") > f <- future(1) > plan(cluster, workers = "localhost", .skip = FALSE) > res <- tryCatch({ + value(f) + }, FutureError = function(ex) { + message(conditionMessage(ex)) + ex + }) Warning in doTryCatch(return(expr), name, parentenv, handler) : NAs introduced by coercion ClusterFuture () failed to receiving message from cluster RichSOCKnode #1 (PID 70044 on localhost 'localhost'). The reason reported was 'Connection to the worker is corrupt'. Post-mortem diagnostic: No process exists with this PID, i.e. the localhost worker is no longer alive. The socket connection to the worker of ClusterFuture future () is lost or corrupted: Connection (connection: index=4, description="<-CRANwin3.fb05.statistik.uni-dortmund.de:35472", class="sockconn", mode="a+b", text="binary", opened="opened", can read="yes", can write="yes", id=298, raw_id="") is no longer valid. It differ from the currently registered R connection with the same index 4 (connection: index=4, description="<-CRANwin3.fb05.statistik.uni-dortmund.de:35472", class="sockconn", mode="a+b", text="binary", opened="opened", can read="yes", can write="yes", id=301, raw_id=""). As an example, this may happen if base::closeAllConnections() have been called, for instance via base::sys.save.image() which in turn is called if the R session (pid 152708) is forced to terminate > stopifnot(inherits(res, "FutureError")) > > message("*** cluster() - exception when re-creating workers ... DONE") *** cluster() - exception when re-creating workers ... DONE > > > message("*** cluster() ... DONE") *** cluster() ... DONE > > ## Sanity checks > pid2 <- Sys.getpid() > message("Main PID (original): ", pid) Main PID (original): 152708 > message("Main PID: ", pid2) Main PID: 152708 > stopifnot(pid2 == pid) > > source("incl/end.R") Failed to undo environment variables: - Expected environment variables: [n=204] '!ExitCode', 'ALLUSERSPROFILE', 'APPDATA', 'BIBINPUTS', 'BINDIR', 'BSTINPUTS', 'COMMONPROGRAMFILES', 'COMPUTERNAME', 'COMSPEC', 'CURL_CA_BUNDLE', 'CYGWIN', 'CommonProgramFiles(x86)', 'CommonProgramW6432', 'DriverData', 'HOME', 'HOMEDRIVE', 'HOMEPATH', 'JAGS_ROOT', 'JAVA_HOME', 'LANGUAGE', 'LC_COLLATE', 'LC_MONETARY', 'LC_TIME', 'LOCALAPPDATA', 'LOGONSERVER', 'LS_HOME', 'LS_LICENSE_PATH', 'MAKE', 'MAKEFLAGS', 'MAKELEVEL', 'MFLAGS', 'MSMPI_BENCHMARKS', 'MSMPI_BIN', 'MSYS2_ENV_CONV_EXCL', 'NUMBER_OF_PROCESSORS', 'OCL', 'OMP_THREAD_LIMIT', 'OS', 'PATH', 'PATHEXT', 'PROCESSOR_ARCHITECTURE', 'PROCESSOR_IDENTIFIER', 'PROCESSOR_LEVEL', 'PROCESSOR_REVISION', 'PROGRAMFILES', 'PROMPT', 'PSModulePath', 'PUBLIC', 'PWD', 'ProgramData', 'ProgramFiles(x86)', 'ProgramW6432', 'RTOOLS43_HOME', 'RTOOLS44_HOME', 'R_ARCH', 'R_BROWSER', 'R_BZIPCMD', 'R_CMD', 'R_COMPILED_BY', 'R_CRAN_WEB', 'R_CUSTOM_TOOLS_PATH', 'R_CUSTOM_TOOLS_SOFT', 'R_DOC_DIR', 'R_ENVIRON_USER', 'R_GSCMD', 'R_GZIPCMD', 'R_HOME', 'R_INCLUDE_DIR', 'R_INSTALL_TAR', 'R_LIBS', 'R_LIBS_SITE', 'R_LIBS_USER', 'R_MAX_NUM_DLLS', 'R_OSTYPE', 'R_PAPERSIZE', 'R_PAPERSIZE_USER', 'R_PARALLELLY_MAKENODEPSOCK_AUTOKILL', 'R_PARALLELLY_MAKENODEPSOCK_CONNECTTIMEOUT', 'R_PARALLELLY_MAKENODEPSOCK_RSCRIPT_LABEL', 'R_PARALLELLY_MAKENODEPSOCK_SESSIONINFO_PKGS', 'R_PARALLELLY_MAKENODEPSOCK_TIMEOUT', 'R_PARALLELLY_RANDOM_PORTS', 'R_PARALLEL_PORT', 'R_RD4PDF', 'R_RTOOLS44_PATH', 'R_SCRIPT_LEGACY', 'R_SHARE_DIR', 'R_TESTS', 'R_UNZIPCMD', 'R_USER', 'R_VERSION', 'R_ZIPCMD', 'SED', 'SHLVL', 'SYSTEMDRIVE', 'SYSTEMROOT', 'TAR', 'TAR_OPTIONS', 'TEMP', 'TERM', 'TEXINPUTS', 'TMP', 'TMPDIR', 'USERDOMAIN', 'USERDOMAIN_ROAMINGPROFILE', 'USERNAME', 'USERPROFILE', 'WINDIR', '_', '_R_CHECK_AUTOCONF_', '_R_CHECK_BOGUS_RETURN_', '_R_CHECK_BROWSER_NONINTERACTIVE_', '_R_CHECK_BUILD_VIGNETTES_SEPARATELY_', '_R_CHECK_CODETOOLS_PROFILE_', '_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_', '_R_CHECK_CODE_ATTACH_', '_R_CHECK_CODE_CLASS_IS_STRING_', '_R_CHECK_CODE_DATA_INTO_GLOBALENV_', '_R_CHECK_CODE_USAGE_VIA_NAMESPACES_', '_R_CHECK_CODE_USAGE_WITHOUT_LOADING_', '_R_CHECK_CODE_USAGE_WITH_ONLY_BASE_ATTACHED_', '_R_CHECK_CODOC_VARIABLES_IN_USAGES_', '_R_CHECK_COMPACT_DATA2_', '_R_CHECK_COMPILATION_FLAGS_', '_R_CHECK_CONNECTIONS_LEFT_OPEN_', '_R_CHECK_CRAN_INCOMING_', '_R_CHECK_CRAN_INCOMING_CHECK_FILE_URIS_', '_R_CHECK_CRAN_INCOMING_CHECK_URLS_IN_PARALLEL_', '_R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_', '_R_CHECK_CRAN_INCOMING_REMOTE_', '_R_CHECK_CRAN_INCOMING_USE_ASPELL_', '_R_CHECK_DATALIST_', '_R_CHECK_DEPRECATED_DEFUNCT_', '_R_CHECK_DOC_SIZES2_', '_R_CHECK_DOT_FIRSTLIB_', '_R_CHECK_DOT_INTERNAL_', '_R_CHECK_EXAMPLE_TIMING_THRESHOLD_', '_R_CHECK_EXECUTABLES_', '_R_CHECK_EXECUTABLES_EXCLUSIONS_', '_R_CHECK_FF_CALLS_', '_R_CHECK_FF_DUP_', '_R_CHECK_FORCE_SUGGESTS_', '_R_CHECK_FUTURE_FILE_TIMESTAMPS_', '_R_CHECK_FUTURE_FILE_TIMESTAMPS_LEEWAY_', '_R_CHECK_HAVE_MYSQL_', '_R_CHECK_HAVE_ODBC_', '_R_CHECK_HAVE_PERL_', '_R_CHECK_HAVE_POSTGRES_', '_R_CHECK_INSTALL_DEPENDS_', '_R_CHECK_INTERNALS2_', '_R_CHECK_LENGTH_1_CONDITION_', '_R_CHECK_LICENSE_', '_R_CHECK_LIMIT_CORES_', '_R_CHECK_MATRIX_DATA_', '_R_CHECK_MBCS_CONVERSION_FAILURE_', '_R_CHECK_NATIVE_ROUTINE_REGISTRATION_', '_R_CHECK_NEWS_IN_PLAIN_TEXT_', '_R_CHECK_NO_RECOMMENDED_', '_R_CHECK_NO_STOP_ON_TEST_ERROR_', '_R_CHECK_ORPHANED_', '_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_', '_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_', '_R_CHECK_PACKAGES_USED_IN_TESTS_USE_SUBDIRS_', '_R_CHECK_PACKAGE_DATASETS_SUPPRESS_NOTES_', '_R_CHECK_PACKAGE_NAME_', '_R_CHECK_PKG_SIZES_', '_R_CHECK_PKG_SIZES_THRESHOLD_', '_R_CHECK_PRAGMAS_', '_R_CHECK_RD_EXAMPLES_T_AND_F_', '_R_CHECK_RD_LINE_WIDTHS_', '_R_CHECK_RD_MATH_RENDERING_', '_R_CHECK_RD_NOTE_LOST_BRACES_', '_R_CHECK_RD_VALIDATE_RD2HTML_', '_R_CHECK_REPLACING_IMPORTS_', '_R_CHECK_R_DEPENDS_', '_R_CHECK_S3_METHODS_SHOW_POSSIBLE_ISSUES_', '_R_CHECK_SCREEN_DEVICE_', '_R_CHECK_SERIALIZATION_', '_R_CHECK_SHLIB_OPENMP_FLAGS_', '_R_CHECK_SRC_MINUS_W_IMPLICIT_', '_R_CHECK_SUBDIRS_NOCASE_', '_R_CHECK_SUGGESTS_ONLY_', '_R_CHECK_SYSTEM_CLOCK_', '_R_CHECK_TESTS_NLINES_', '_R_CHECK_TEST_TIMING_', '_R_CHECK_TIMINGS_', '_R_CHECK_TOPLEVEL_FILES_', '_R_CHECK_UNDOC_USE_ALL_NAMES_', '_R_CHECK_UNSAFE_CALLS_', '_R_CHECK_URLS_SHOW_301_STATUS_', '_R_CHECK_VC_DIRS_', '_R_CHECK_VIGNETTES_NLINES_', '_R_CHECK_VIGNETTES_SKIP_RUN_MAYBE_', '_R_CHECK_VIGNETTE_TIMING_', '_R_CHECK_VIGNETTE_TITLES_', '_R_CHECK_WINDOWS_DEVICE_', '_R_CHECK_XREFS_USE_ALIASES_FROM_CRAN_', '_R_CLASS_MATRIX_ARRAY_', '_R_DEPRECATED_IS_R_', '_R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_', '_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_', '__R_CHECK_DOC_FILES_NOTE_IF_ALL_SPECIAL__', 'maj.version', 'nextArg--timingsnextArg--install' - Environment variables still there: [n=0] - Environment variables missing: [n=1] 'MAKEFLAGS' Differences environment variable by environment variable: List of 3 $ name : chr "MAKEFLAGS" $ expected: 'Dlist' chr "" $ actual : 'Dlist' chr NA > > proc.time() user system elapsed 0.68 0.29 8.14