Error in unserialize(socklist[[n]]) : error reading from connection Error in serialize(data, node$con, xdr = FALSE) : error writing to connection

#1

I am trying to run sampling for 40 iterations and each time i get the following error:

Error in unserialize(socklist[[n]]) : error reading from connection
Error in serialize(data, node$con, xdr = FALSE) :
error writing to connection
When i try to do it with chains=1 it crushes…

I used all the recommended commands :
rstan_options(auto_write=TRUE)
options(mc.cores=parallel::detectCores())

Output of sessionInfo:
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages:
[1] rstan_2.18.2 StanHeaders_2.18.1 ggplot2_3.1.0

loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 pillar_1.3.1 compiler_3.5.2 plyr_1.8.4 bindr_0.1.1
[6] prettyunits_1.0.2 tools_3.5.2 pkgbuild_1.0.2 tibble_2.0.1 gtable_0.2.0
[11] pkgconfig_2.0.2 rlang_0.3.1 cli_1.0.1 rstudioapi_0.9.0 parallel_3.5.2
[16] yaml_2.2.0 loo_2.0.0 bindrcpp_0.2.2 gridExtra_2.3 withr_2.1.2
[21] dplyr_0.7.8 stats4_3.5.2 grid_3.5.2 tidyselect_0.2.5 glue_1.3.0
[26] inline_0.3.15 R6_2.3.0 processx_3.2.1 purrr_0.2.5 callr_3.1.1
[31] magrittr_1.5 codetools_0.2-15 scales_1.0.0 ps_1.3.0 matrixStats_0.54.0
[36] assertthat_0.2.0 colorspace_1.4-0 lazyeval_0.2.1 munsell_0.5.0 crayon_1.3.4

I would really appreciate any help.
Thanks

0 Likes

#2

When you do chains = 1, is there an error message? Also, are you using integrate_bdf?

0 Likes

#3

No…R crushes ;(

0 Likes

#4

Now it worked normally with chains=1…
Its strange because when i place priors in my hyperparameters in the model and i put chains=1 R crushes…
When i don’t, it only work for chain=1 and for a small amount of iterations.
Is there a way to fix this?
Thank you

0 Likes

#5

I’m getting the same error (everytime) when running the ‘blocker’ example from RStudio on Version 1.2.1330.
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763) (5 Core, Intel Core i7-8700)

ie.
fit <- stan(file = ‘blocker.stan’, data = blocker_dat)
Error in unserialize(socklist[[n]]) : error reading from connection
Error in serialize(data, node$con, xdr = FALSE) :
error writing to connection

The error goes away when I run on a single core.

Error in unserialize(socklist[[n]]) : error reading from connection
Error in serialize(data, node$con, xdr = FALSE)

0 Likes

#6

Can you do any models in parallel? I would guess there is some permissions thing that is preventing reading the compiled model from the disk in the child processes.

0 Likes

#7

I tried running RStudio as administrator, same consistent error with blocker model. Inferestingly, I don’t get this error when running the 8schools model in parallel (i.e. ‘options(mc.cores = parallel::detectCores())’).

No issues on same machine running Linux.

0 Likes

#8

Maybe you have an old compiled instance of the blocker model? Try deleting blocker.rds in that folder.

0 Likes

#9

I removed ‘blocker.rds’ and re-ran. After a few seconds, the following appears in the ‘Viewer’ pane in RStudio:

Click the Refresh button to see progress of the chains

starting worker pid=3112 on localhost:11763 at 11:54:33.691

starting worker pid=19984 on localhost:11763 at 11:54:33.820

starting worker pid=22368 on localhost:11763 at 11:54:33.947

The fit stops with the same error.

0 Likes

#10

What happens if you hit refresh?

0 Likes

#11

After clicking refresh, the viewer pane displays the following, then quits with the error message.

SAMPLING FOR MODEL ‘blocker’ NOW (CHAIN 1).

Chain 1:

Chain 1: Gradient evaluation took 0 seconds

Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.

Chain 1: Adjust your expectations accordingly!

Chain 1:

Chain 1:

Chain 1: Iteration: 1 / 2000 [ 0%] (Warmup)

SAMPLING FOR MODEL ‘blocker’ NOW (CHAIN 2).

Chain 2:

Chain 2: Gradient evaluation took 0 seconds

Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.

Chain 2: Adjust your expectations accordingly!

Chain 2:

Chain 2:

Chain 2: Iteration: 1 / 2000 [ 0%] (Warmup)

SAMPLING FOR MODEL ‘blocker’ NOW (CHAIN 3).

Chain 3:

Chain 3: Gradient evaluation took 0 seconds

Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.

Chain 3: Adjust your expectations accordingly!

Chain 3:

Chain 3:

Chain 3: Iteration: 1 / 2000 [ 0%] (Warmup)

SAMPLING FOR MODEL ‘blocker’ NOW (CHAIN 4).

Chain 4:

Chain 4: Gradient evaluation took 0 seconds

Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.

Chain 4: Adjust your expectations accordingly!

Chain 4:

Chain 4:

Chain 4: Iteration: 1 / 2000 [ 0%] (Warmup)

0 Likes

#12

On a hunch, I uninstalled the ‘Killer Control Center Application’ that came factory installed. the error now no longer occurs.

https://www.dell.com/support/home/us/en/19/drivers/driversdetails?driverid=gw0hw&lwp=rt

I haven’t confirmed by re-installing, but thought I’d report here in case this bites someone else.

0 Likes

#13

Unfortunately, without making any known changes to my system, the error has returned and cannot be blamed on the ‘Killer Control Center Application’.

0 Likes

#14

I don’t know anything about the “Killer Control Center Application”. Can you run

example(parLapplyLB, package = "parallel", run.dontrun = TRUE)

or that system? Can you run stan with cores = 1?

0 Likes

#15

Yes to both. Thanks.

bgoodri

April 1

I don’t know anything about the “Killer Control Center Application”. Can you run

example(parLapplyLB, package = "parallel", run.dontrun = TRUE)

Yes, this example from "parallel’ runs without error.



or that system? Can you run stan with cores = 1?

Yes, when I set “options(mc.cores = 1)”, the blocker example runs without error.

When I substitute “options(mc.cores = parallel::detectCores())”, I get:

fit <- stan(file = ‘blocker.stan’, data = blocker_dat)

Error in unserialize(socklist[[n]]) : error reading from connection

Error in serialize(data, node$con, xdr = FALSE) :

error writing to connection

0 Likes