Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multisession "future_lapply" error when R quits: Error in unserialize(node$con) : error reading from connection #255

Closed
wlandau opened this issue Feb 14, 2018 · 3 comments

Comments

@wlandau
Copy link
Member

wlandau commented Feb 14, 2018

The errors are the same as futureverse/future#143. They only appear when I quit the R session, so I cannot use traceback() to dig further. They affects both "future_lapply" parallelism on the master branch and "future" parallelism on the i227-attempt2 branch (which is almost ready to alpha test).
Targets appear to build normally anyway, and the errors do not appear with drake 5.0.0 (current CRAN version).

library(drake)
library(future)
load_basic_example()
future::plan(multisession)
make(my_plan, parallelism = "future_lapply")
q()

##  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
## ...
@wlandau
Copy link
Member Author

wlandau commented Feb 14, 2018

Also, for the non-HPC backends, this one seems specific to future::multisession. The sequential and multicore backends appear unaffected.

@wlandau
Copy link
Member Author

wlandau commented Feb 14, 2018

MWE:

library(future)
future::plan(multisession)
f <- future::future(capture.output(1+1, type = "message"))
q()

## Error in unserialize(node$con) : error reading from connection
## Calls: <Anonymous> ... doTryCatch -> recvData -> recvData.SOCKnode -> unserialize
## Execution halted

So I think it's because of this capture.output() call from when I fixed #212. Not yet sure how/whether to fix it. Drake should continue to capture and store messages somehow so users can retrieve them with diagnose(whatever_target).

@wlandau wlandau changed the title Strange error messages for "future_lapply" parallelism when R quits. "future_lapply" error when R quits: Error in unserialize(node$con) : error reading from connection Feb 15, 2018
@wlandau wlandau changed the title "future_lapply" error when R quits: Error in unserialize(node$con) : error reading from connection multisession "future_lapply" error when R quits: Error in unserialize(node$con) : error reading from connection Feb 15, 2018
@wlandau
Copy link
Member Author

wlandau commented Feb 15, 2018

As @HenrikBengtsson said, users can get around this one either by using future.callr::callr or by creating and cleaning up an explicit PSOCK cluster. See also: HenrikBengtsson/Wishlist-for-R#55. I think archiving this explanation is enough. I believe drake should still continue capturing messages for diagnose().

library(future)
cl <- parallel::makeCluster(2L)
plan("cluster", workers = cl)  ## same as plan(multisession, workers = 2L)
> f <- future(capture.output(message("hello"), type = "message"))
> value(f)
[1] "hello"
> f <- future(capture.output(message("world"), type = "message"))
> value(f)
[1] "world"
> parallel::stopCluster(cl)
> q("no")

@wlandau wlandau closed this as completed Feb 15, 2018
rnedelec pushed a commit to rnedelec/biodivMapR that referenced this issue Mar 11, 2024
jbferet added a commit to jbferet/biodivMapR that referenced this issue Apr 25, 2024
## Fix

- fixed problem occurring when performing PCA without mask
- fixed issue related to plan(multisession), suggested by @rnedelec on github,
following documented issue in ropensci/drake#255 (comment)

## Addition

- option added to display progress bar. Set to FALSE as default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant