2.15.1 problems and whether to revert or wait

I’m using Windows 10, R 3.4, Rtools 3.4, RStudio 1.0.143, and Stan 2.15.1 … or trying to. I reinstalled my entire system to update it, and rstan is now randomly breaking (random with a high probability).

I’ve got a half dozen models that all ran entirely reliably under 2.13 and 2.14, and don’t run reliably under 2.15.1. I’m trying to sort out some rhyme or reason for it all. rats.stan and my simplest model seem to run OK… always? A slightly more involved model worked fine once and now sometimes gives a compilation error, sometimes fails to connect, and sometimes works.

There are a number of warnings and messages that I don’t remember from before, including (in some combination from one run to the next and one RStudio session to the next):

“recompiling to avoid crashing R session”

“Gradient evaluation took 0 seconds
1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Adjust your expectations accordingly!”

"Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! 0 [main] make (1320) c:\Rtools\bin\make.exe: *** fatal error - cygheap base mismatch detected - 0xF97408/0x10D7408.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version. The most recent version should
reside in x:\cygwin\bin, where ‘x’ is the drive on which you have
installed the cygwin distribution. Rebooting is also suggested if you
are unable to find another cygwin DLL.
0 [main] make 10764 fork: child -1 - forked process 1320 died unexpectedly, retry 0, exit code 0xC0000142, errno 11
make: vfork: Resource temporarily unavailable
Warning message:
running command ‘make -f “C:/PROGRA~1/R/R-34~1.0/etc/x64/Makeconf” -f “C:/PROGRA~1/R/R-34~1.0/share/make/winshlib.mk” -f “D:/Users/helink/Documents/.R/Makevars” SHLIB_LDFLAGS=’(SHLIB_CXXLDFLAGS)' SHLIB_LD='(SHLIB_CXXLD)’ SHLI
In addition: Warning message:
running command ‘C:/PROGRA~1/R/R-34~1.0/bin/x64/R CMD SHLIB file2c3c7c4e3aaa.cpp 2> file2c3c7c4e3aaa.cpp.err.txt’ had status 1
"

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

When I run with cores=1 things are generally more stable but not perfect. When I run four chains on four cores, things are generally less stable but not always failing. R encounters a fatal error sometimes once a chain starts to warm up on cores=1 after failing to connect calling stan with cores=4. I’ve rebooted since my install and only have one cygwin.dll anywhere.

So, I’ve seen people having trouble with 2.15.1, here

and here Redirecting to Google Groups

Has the issue been pinned down or do you need help isolating it? And should I revert to 2.14 or some such, or is a 2.16 that fixes whatever issues we’re having expected to be out soon?

thanks,
ham

The following seems to work reliably:

library(rstan)
rstan_options(auto_write = TRUE)
options(mc.cores = 4) # for output see the “Viewer” tab

y <- as.matrix(read.table(‘https://raw.github.com/wiki/stan-dev/rstan/rats.txt’, header = TRUE))
x <- c(8, 15, 22, 29, 36)
xbar <- mean(x)
N <- nrow(y)
T <- ncol(y)
rats_fit <- stan(file = ‘d:/users/helink/desktop/rats.stan’, chains=4, cores=1)
summary(rats_fit)$summary
rats_fit <- stan(file = ‘d:/users/helink/desktop/rats.stan’, chains=4, cores=4)
rats_fit <- stan(file = ‘d:/users/helink/desktop/rats.stan’, chains=4, cores=1)

That was a runtime error from a model that didn’t specify the constraints properly, although since 2.15.x, you have not been able to see the exception messages. What you are describing is much different. We don’t test with Cygwin, so I can’t say I am surprised. But I don’t know why it would fail like this for some models but not others and in some circumstances but not others. While we will probably release 2.16.x soon, there is nothing in it that specifically addresses this problem, as this is the first we have heard about it.

Thanks for reporting—we very much want to know when Stan behaves erratically in one of the interfaces.

Many of our developers use RStan for their applied work, and none of us have had problems with 2.15, but then none of us use Windows. And as Ben mentioned, we assume Windows users will use the Rtools distribution, not Cygwin—it looks like your system is somehow trying to use both, so it may be running in binary incompatibilities somewhere.

If you have a reproducible example, we can try testing in our own Windows testing installs.

I am using the Rtools distribution.

I have a reproducible test case but my forum message is unsubmitted on the
computer at work. It includes what versions of things I’m running – R
3.4, Rtools 3.4, RStudio 1.0.143, and rstan 2.15.1. Sorry for emailing you
here, I’ll push send on the forum message when I get in on Monday.

The email came to the group, so no worries.

I was only drawing conclusions from the error message:

"Error in compileCode(f, code, language = language, verbose = verbose) : 
Compilation ERROR, function(s)/method(s) not created! 0 [main] make (1320) c:\Rtools\bin\make.exe: *** fatal error - cygheap base mismatch detected - 0xF97408/0x10D7408.
This problem is probably due to using incompatible versions of the cygwin DLL.
Search for cygwin1.dll using the Windows Start->Find/Search facility
and delete all but the most recent version. The most recent version should
reside in x:\cygwin\bin, where 'x' is the drive on which you have
installed the cygwin distribution. Rebooting is also suggested if you
are unable to find another cygwin DLL.

Ok. I’ll see if I can produce a reliable failure.

I just ran a (fairly simple) model several times. I loaded my data, ran the model with cores=1 and cores=4, alternating back and forth and it ran every time. THEN, I set up the data for a (almost as simple) model and tried to run it (without restarting Rstudio) and got the big cygwin error.

When I restarted RStudio and only ran the second model, it worked for cores=1, I got the
"
Error in unserialize(socklist[[n]]) : error reading from connection
Error in serialize(data, node$con, xdr = FALSE) :
error writing to connection
"
error upon rerunning it immediately with cores=4, and then trying to run it again with cores=1 gave me a fatal error and terminated my R session (but not Rstudio).

This is reliably reproducible.

I should also say. There is a cygwin.dll on my computer, but there’s only one, and I didn’t install cygwin separately deliberately – I assumed it was installed with Rtools, but…

Hmm… now that I think about it, it may have been installed with MikTex when I installed TexWorks.

In that case, it should not be linking to cygwin.dll .