Skip to content

Error in unserialize: MultisessionFuture (<none>) failed to receive results from cluster RichSOCKnode #1 (PID 235 on ‘localhost’) #569

@can-taslicukur

Description

@can-taslicukur

Hi i am using promises with future in my shiny app to make async queries to MySQL database. This is the code that i use to send asynchronous query to database

library(promises)
library(future)
plan(multisession)

dat <- future_promise({
    con <- dbConnect(MySQL(),
                     user = DB_USER, password = DB_PASSWORD,
                     host = DB_HOST, port = DB_PORT,
                     dbname = DB_NAME, encoding = "latin1")
    dbSendQuery(con, "SET NAMES utf8mb4;")
    dbSendQuery(con, "SET CHARACTER SET utf8mb4;")
    dbSendQuery(con, "SET character_set_connection=utf8mb4;")
    dat <- dbGetQuery(con,query$df_sql)
    dbDisconnect(con)
    return(dat)
})

### after some time
dat

However when i run this code, I randomly get the following error

Warning: Error in unserialize: MultisessionFuture (<none>) failed to receive results from cluster RichSOCKnode #1 (PID 235 on ‘localhost’). The reason reported was ‘error reading from connection’. Post-mortem diagnostic: The total size of the 6 globals exported is 74.26 KiB. The three largest globals are ‘query’ (18.91 KiB of class ‘list’) and ‘dbSendQuery’ (10.30 KiB of class ‘function’)

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:

R version 4.1.1 (2021-08-10)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.0.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets 
[6] methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.1.1 DBI_1.1.1      tools_4.1.1   

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions