You are here

R crashes

10 posts / 0 new
Last post
karobro's picture
Joined: 01/16/2013 - 10:41
R crashes

I'm having problems with R crashing with the new beta version. It does not seem to be a problem of excess memory usage, as I've seen in another thread here. What is strange is that after I've downloaded the beta things look fine (see mxVersion below), and it works with a simple twin multivariate saturated script. When I try a more complicated model, this is when R crashes.

> mxVersion()
OpenMx version:
R version: R version 3.1.1 (2014-07-10)
Platform: i386-w64-mingw32
Default optimiser: CSOLNP

Here is information from Windows event Viewer when R crashes:

Faulting application name: Rgui.exe, version: 3.11.579.0, time stamp: 0x53be708a
Faulting module name: OpenMx.dll, version:, time stamp: 0x53ee0f11
Exception code: 0xc0000005
Fault offset: 0x0001a2be
Faulting process id: 0x1820
Faulting application start time: 0x01cfc778c91b0525
Faulting application path: C:\Program Files\R\R-3.1.1\bin\i386\Rgui.exe
Faulting module path: C:\Program Files\R\R-3.1.1\library\OpenMx\libs\i386\OpenMx.dll
Report Id: 3be81308-336c-11e4-87e3-005056ad3f12

Does anyone have any idea what could be causing this? I've tried different computers and R Versions.

RobK's picture
Joined: 04/19/2011 - 21:00

Does it crash when NPSOL is the default optimizer? You can switch from CSOLNP to NPSOL with mxOption(NULL,"Default optimizer","NPSOL").

Also, out of curiosity, what do you see when you enter options()$mxOption$"Number of Threads" into R?

Two other things. First, on which other systems have you observed this crash? Second, could you attach your script or one similar to it?

karobro's picture
Joined: 01/16/2013 - 10:41
mxOption$Number of threads = 0

Thanks for the reply!

Yes, it also crashes with NPSOL.

This is what comes out when entering
options()$mxOption$"Number of Threads"
[1] 0

It also crashed on R 3.0.1, and I've only tried Windows. I should ask the author of the script for permission to post it, so I will come back to this.

tbates's picture
Joined: 07/31/2009 - 14:25
try 1 core?

try running this first to stop it trying to go multi-threaded?

mxOption(NULL, "Number of Threads", 1)
karobro's picture
Joined: 01/16/2013 - 10:41
still crashing

Thanks, but this unfortunately did not work either.

Attached is a version of the script I've used.

RobK's picture
Joined: 04/19/2011 - 21:00
What do nv, nth, and Vars

What do nv, nth, and Vars happen to be in your case?

karobro's picture
Joined: 01/16/2013 - 10:41
nv, nth, Vars

nv <- 3
nth <- 6
Vars <- c('M07nnT','F07nnT','T07nnT')

RobK's picture
Joined: 04/19/2011 - 21:00
Bug with mxFitFunctionMultigroup() ?

I think there's a bug with mxFitFunctionMultigroup(). Try redefining your function to

makeModel  <- function(name) {
  parsZf    <- list( pathAf, pathCf, pathEf, pathRaf, pathRcf, pathRef, covAf, covCf, covEf, covPf, estVarsZf )
  parsZm    <- list( pathAm, pathCm, pathEm, pathRam, pathRcm, pathRem, covAm, covCm, covEm, covPm, estVarsZm )
  parsZfm   <- list( corRao, corRco, covAmf, covCmf, covAfm, covCfm)
  modelMZf  <- mxModel( parsZf, mtGf, covMZf, dataMZf, expFunctionMZf, fitfunction, name="MZf" )
  modelDZf  <- mxModel( parsZf, mtGf, covDZf, dataDZf, expFunctionDZf, fitfunction, name="DZf" )
  modelMZm  <- mxModel( parsZm, mtGm, covMZm, dataMZm, expFunctionMZm, fitfunction, name="MZm" )
  modelDZm  <- mxModel( parsZm, mtGm, covDZm, dataDZm, expFunctionDZm, fitfunction, name="DZm" )
  modelDZo  <- mxModel( parsZf, parsZm, parsZfm, mtGo, covDZo, dataDZo, expFunctionDZo, fitfunction, name="DZo" )
  mgalg <- mxAlgebra(MZf.fitfunction + DZf.fitfunction + MZm.fitfunction + DZm.fitfunction, name="mgalg")
  mgfitfunction <- mxFitFunctionAlgebra("mgalg")
  name      <- mxModel( name, parsZf, parsZm, parsZfm, modelMZf, modelDZf, modelMZm, modelDZm, modelDZo, mgalg,

and see if that prevents the crash.

karobro's picture
Joined: 01/16/2013 - 10:41
it worked

Yes, this prevented the crash! Thank you so much for the help!

neale's picture
Joined: 07/31/2009 - 15:14
The multi group fit function bug has been fixed, yay!

At present the fix is only available for those building from source. Beta 3 should include the fix when it is released. Sorry for the inconvenience.