This is a continuation of the problem that I poorly described here: Complaints about slot "mode" rearing their head again
Hopefully, I’ll have clarified things here.
First off, platform and versions: macOS High Sierra, version 10.13.6; R, version 3.6.1; RStudio, version 1.1.456; RStan, version 2.18.2. [ETA: I’ve updated RStan to version 2.19.2 (and am still seeing the same problems)].
If I sample a couple of my models from within RStudio (given simulated data), then one of two things happens:
-
If
mc.cores = parallel::detectCores()
, then some or all of the chains will die prematurely. With one model, 2 out of 4 chains complete, and with my other model, all of the chains just die. I get the error message “Error in unserialize(socklist[[n]]) : error reading from connection
” after one of the chains dies. Depending on the model, I may also get the error messages:Error in serialize(data, node$con, xdr = FALSE) : ignoring SIGPIPE signal
,Calls: <Anonymous> ... doTryCatch -> sendData -> sendData.SOCK0node -> serialize
, andExecution halted
. When each chain starts, I get a (presumably benign) message like “starting worker pid=6810 on localhost:11280 at 09:48:12.300
”. -
If I don’t set
mc.cores
, then each chain runs in serial, one after the other, and they all finish without any apparent problems.
If I open up a terminal and run R from that terminal, I get different behavior:
-
If
mc.cores = parallel::detectCores()
, then the behavior is almost the same as with RStudio, but the messages differ. The error messages that I get are “Error in FUN(X[[i]], ...) : trying to get slot "mode" from an object of a basic class ("NULL") with no slots
” and “In mccollect(jobs) : N parallel jobs did not deliver results
” (whereN
is 2 or 4). I also don’t see a message like “starting worker pid=6810 on localhost:11280 at 09:48:12.300
”. -
If I don’t set
mc.cores
, then sampling ends prematurely with “Abort trap: 6
”, and the R session itself also terminates. This happens regardless of the number of chains I try to use.
These models used to work just fine. [ETA: After taking a closer look at the timestamps of the files containing MCMC samples, it looks like my models may never have worked with RStan on my Macbook. Those files were generated on a previous machine of mine (a Linux box), and then transferred to the Macbook.] Unfortunately, it’s been a few months since I’ve worked with them, and my system has gone through several updates since I touched them again. It’s not clear to me what update(s) broke things.
PyStan has not given me any of these problems, in any of the versions that I’ve tried, from PyStan 2.17.1.0 to 2.19.0.0. This is when using the same models on similar simulated data. [ETA: Despite the “ETA” bit in the last paragraph, I did confirm that PyStan still works on my MacBook.]
For now, I need to be cautious about posting the models publicly, unfortunately.
Any ideas on what is going on here?