Error in unserialize: MultisessionFuture (<none>) failed to receive results from cluster RichSOCKnode #1 (PID 235 on ‘localhost’) #570
Replies: 2 comments 10 replies
-
Thanks for reporting. It's hard to say why this happens - to me, the code looks valid and there are no obvious pitfalls as far as I can tell. FWIW, out of the millions(!) multisession futures, I've created over time, I might have ran into this problem maybe once or twice. What is more common is when one exhaust the worker so it crashes, but then the error message says that the worker is no longer alive - that's not the problem in your case. The only thing I can imagine right now is that the returned results are really large, and that somehow causes problems for R's serialize/unserialize. What range of To see this, or if this happens for specific SQL query (don't see why though), you could try to write debug info to a file. (We can't use Another immediate thing you can do is to try with another, completely different, parallel backend, e.g. plan(future.callr::callr) That transfers data back and forth between the main R session and the workers differently from Since you're on macOS, you could of course also try with Beyond that, I'd suggest you try to reproduce the issue without using shiny and promises. For example, you could stress test this with something like: library(future)
plan(multisession)
log <- function(..., logfile = "troubleshoot.log") {
msg <- sprintf(...)
cat(msg, "\n", sep = "", file = logfile, append = TRUE)
}
query <- "<a typical SQL query>"
repeat({
f <- future({
log("Connecting to DB")
con <- dbConnect(MySQL(),
user = DB_USER, password = DB_PASSWORD,
host = DB_HOST, port = DB_PORT,
dbname = DB_NAME, encoding = "latin1")
log("Initiate DB query")
dbSendQuery(con, "SET NAMES utf8mb4;")
dbSendQuery(con, "SET CHARACTER SET utf8mb4;")
dbSendQuery(con, "SET character_set_connection=utf8mb4;")
log("Querying DB: %s", sQuote(query))
dat <- dbGetQuery(con, query)
log("Disconnecting from DB")
dbDisconnect(con)
log("Returning results of size: %g bytes", objectSize(dat))
return(dat)
})
v <- value(f)
str(v)
}) If you can reproduce it this way, that would also help narrow in on the problem. PS. Your session info lists neither future or promises. |
Beta Was this translation helpful? Give feedback.
-
#check the current active plan |
Beta Was this translation helpful? Give feedback.
-
Hi i am using
promises
withfuture
in my shiny app to make async queries to MySQL database. This is the code that i use to send asynchronous query to databaseHowever when i run this code, I randomly get the following error
Why do I get this error at random? Sometimes it works exactly like I wanted but sometimes i get this weird error. How can i fix it?
Session Info:
Beta Was this translation helpful? Give feedback.
All reactions