colin
colin

Reputation: 2666

long JAGS simulations keep hanging on Rstudio server with strange error message

I am running some JAGS models using the runjags package for R. I run R through Rstudio on a remote server. Recently,I started getting this error on long model runs (> 30 minutes). It doesn't happen every run, but more than 50% of runs. Furthermore, I can run identical code and it happens some times but not others. This tells me it may be a server issue rather than a JAGS or runjags issue per se. Any guesses? I don't even know where to find these log files the error message references.

Error: The following error was encountered while attempting to run the JAGS model:  
   One or more rjags sessions failed with the following error:
Error in unserialize(node$con) : error reading from connection

The worker log file (which may also help with debugging) is:
starting worker pid=8549 on localhost:11467 at 16:54:51.985
starting worker pid=8550 on localhost:11467 at 16:54:52.028
starting worker pid=8551 on localhost:11467 at 16:54:52.072


NOTE: Stopping adaptation


NOTE: Stopping adaptation


NOTE: Stopping adaptation


Have you remembered to specify all required modules and factories?

Upvotes: 1

Views: 505

Answers (1)

Matt Denwood
Matt Denwood

Reputation: 2583

This error is telling you that one (or more) of the worker threads died for some reason, possibly due to a lack of memory. Is the model quite big, and/or you are asking for lots of models?

To provide more debugging information you can create your own cluster (see ?parallel::makeCluster) with an outfile argument, and then pass the cluster to run.jags using the cl argument. This might give you the error that the cluster node(s) died with...

Googling the error also comes up with a few related questions on this site including:

doParallel error in R: Error in serialize(data, node$con) : error writing to connection

The error itself isn't due to runjags/JAGS so you can ignore that part.

Upvotes: 1

Related Questions