MarcLavielle / mlxR

mlxR
Other
18 stars 5 forks source link

R segfault running tutorial example #23

Open mayerbry opened 5 years ago

mayerbry commented 5 years ago

I was trying to run the tutorial code for using simulx (downloaded the project scripts from this link) and it crashed my R session.

Code and error as follows:

> setwd("~/simulx_forWebsite/simulx/")
> library(mlxR)
Loading required package: ggplot2
> project.file <- '../monolixProjects/project_07.mlxtran'
> res1  <- simulx(project = project.file)

 *** caught segfault ***
address 0x18, cause 'memory not mapped'

Traceback:
 1: simulxunit(model = model, lv = lv, settings = settings, out.trt = out.trt,     riov = riov)
 2: simulx(project = project.file)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

(RStudio crashed without providing an error.)

I dug a little deeper using lldb

(lldb) process attach --name rsession --waitfor
libR.dylib was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 24593 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x0000000101262f9b libR.dylib`R_Parse1File at gram.c:3534 [opt]
Target 0: (rsession) stopped.

Executable module set to "/Applications/RStudio.app/Contents/MacOS/rsession".
Architecture set to: x86_64h-apple-macosx.
(lldb) c
Process 24593 resuming
libR.dylib was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 24593 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
    frame #0: 0x000000010da37022 libR.dylib`GetNewPage(node_class=<unavailable>) at memory.c:895 [opt]
Target 0: (rsession) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)
  * frame #0: 0x000000010da37022 libR.dylib`GetNewPage(node_class=<unavailable>) at memory.c:895 [opt]
    frame #1: 0x000000010da3bad2 libR.dylib`Rf_allocVector3(type=13, length=<unavailable>, allocator=<unavailable>) at memory.c:2486 [opt]
    frame #2: 0x000000010d907d4f libR.dylib`get_package_CEntry_table [inlined] Rf_allocVector(type=13, length=1) at Rinlinedfuns.h:196 [opt]
    frame #3: 0x000000010d907d4a libR.dylib`get_package_CEntry_table [inlined] Rf_ScalarInteger(x=0) at Rinlinedfuns.h:594 [opt]
    frame #4: 0x000000010d907d4a libR.dylib`get_package_CEntry_table(package="Rcpp") at Rdynload.c:1415 [opt]
    frame #5: 0x000000010d907e06 libR.dylib`R_GetCCallable(package="Rcpp", name="enterRNGScope") at Rdynload.c:1440 [opt]
    frame #6: 0x000000010bee609e mlxComputeR.so`mlxComputeR + 78
    frame #7: 0x000000010120d48d libR.dylib`R_doDotCall(ofun=<unavailable>, nargs=<unavailable>, cargs=<unavailable>, call=0x000000010726c288) at dotcode.c:570 [opt]
    frame #8: 0x000000010120f333 libR.dylib`do_dotcall(call=0x000000010726c288, op=<unavailable>, args=<unavailable>, env=<unavailable>) at dotcode.c:1252 [opt]
    frame #9: 0x00000001012428de libR.dylib`bcEval(body=<unavailable>, rho=0x00000001072705d0, useCache=<unavailable>) at eval.c:6738 [opt]
    frame #10: 0x000000010123d7db libR.dylib`Rf_eval(e=<unavailable>, rho=<unavailable>) at eval.c:624 [opt]
    frame #11: 0x000000010125014c libR.dylib`R_execClosure(call=0x0000000108fab0b8, newrho=0x00000001072705d0, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #12: 0x00000001012427f3 libR.dylib`bcEval(body=<unavailable>, rho=0x000000010ca5dd58, useCache=<unavailable>) at eval.c:6749 [opt]
    frame #13: 0x000000010123d7db libR.dylib`Rf_eval(e=<unavailable>, rho=<unavailable>) at eval.c:624 [opt]
    frame #14: 0x000000010125014c libR.dylib`R_execClosure(call=0x000000010ca140e8, newrho=0x000000010ca5dd58, sysparent=<unavailable>, rho=<unavailable>, arglist=<unavailable>, op=<unavailable>) at eval.c:0 [opt]
    frame #15: 0x000000010123dd0c libR.dylib`Rf_eval(e=0x000000010ca143c0, rho=0x0000000102046198) at eval.c:747 [opt]
    frame #16: 0x0000000101253169 libR.dylib`do_set(call=<unavailable>, op=0x0000000102802ee8, args=0x000000010ca14350, rho=0x0000000102046198) at eval.c:2787 [opt]
    frame #17: 0x000000010123d9ce libR.dylib`Rf_eval(e=<unavailable>, rho=0x0000000102046198) at eval.c:699 [opt]
    frame #18: 0x0000000101280bda libR.dylib`Rf_ReplIteration(rho=0x0000000102046198, savestack=<unavailable>, browselevel=0, state=0x00007ffeefbfc8b0) at main.c:258 [opt]
    frame #19: 0x00000001012821bf libR.dylib`run_Rmainloop [inlined] R_ReplConsole(rho=<unavailable>, savestack=0, browselevel=0) at main.c:308 [opt]
    frame #20: 0x0000000101282156 libR.dylib`run_Rmainloop at main.c:1082 [opt]
    frame #21: 0x00000001008522f9 rsession`rstudio::r::session::runEmbeddedR(rstudio::core::FilePath const&, rstudio::core::FilePath const&, bool, bool, SA_TYPE, rstudio::r::session::Callbacks const&, rstudio::r::session::InternalCallbacks*) + 425
    frame #22: 0x00000001008312fc rsession`rstudio::r::session::run(rstudio::r::session::ROptions const&, rstudio::r::session::RCallbacks const&) + 3164
    frame #23: 0x0000000100109063 rsession`main + 28963
    frame #24: 0x0000000100003cb4 rsession`start + 52

My session info prior to running the code:

> library(mlxR)
Loading required package: ggplot2
> devtools::session_info()
─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 3.5.1 (2018-07-02)
 os       macOS  10.14.3
 system   x86_64, darwin15.6.0
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/Los_Angeles
 date     2019-02-06

─ Packages ───────────────────────────────────────────────────────────────────
 package     * version   date       lib source
 assertthat    0.2.0     2017-04-11 [1] CRAN (R 3.5.0)
 backports     1.1.3     2018-12-14 [1] CRAN (R 3.5.0)
 bindr         0.1.1     2018-03-13 [1] CRAN (R 3.5.0)
 bindrcpp      0.2.2     2018-03-29 [1] CRAN (R 3.5.0)
 callr         3.1.1     2018-12-21 [1] CRAN (R 3.5.0)
 cli           1.0.1     2018-09-25 [1] CRAN (R 3.5.0)
 colorspace    1.4-0     2019-01-13 [1] CRAN (R 3.5.2)
 crayon        1.3.4     2017-09-16 [1] CRAN (R 3.5.0)
 desc          1.2.0     2018-05-01 [1] CRAN (R 3.5.0)
 devtools      2.0.1     2018-10-26 [1] CRAN (R 3.5.1)
 digest        0.6.18    2018-10-10 [1] CRAN (R 3.5.0)
 dplyr         0.7.8     2018-11-10 [1] CRAN (R 3.5.1)
 fs            1.2.6     2018-08-23 [1] CRAN (R 3.5.0)
 ggplot2     * 3.1.0     2018-10-25 [1] CRAN (R 3.5.1)
 glue          1.3.0     2018-07-17 [1] CRAN (R 3.5.0)
 gtable        0.2.0     2016-02-26 [1] CRAN (R 3.5.0)
 lazyeval      0.2.1     2017-10-29 [1] CRAN (R 3.5.0)
 magrittr      1.5       2014-11-22 [1] CRAN (R 3.5.0)
 memoise       1.1.0     2017-04-21 [1] CRAN (R 3.5.0)
 mlxR        * 3.3.0     2018-02-20 [1] CRAN (R 3.5.1)
 munsell       0.5.0     2018-06-12 [1] CRAN (R 3.5.0)
 pillar        1.3.1     2018-12-15 [1] CRAN (R 3.5.0)
 pkgbuild      1.0.2     2018-10-16 [1] CRAN (R 3.5.0)
 pkgconfig     2.0.2     2018-08-16 [1] CRAN (R 3.5.0)
 pkgload       1.0.2     2018-10-29 [1] CRAN (R 3.5.0)
 plyr          1.8.4     2016-06-08 [1] CRAN (R 3.5.0)
 prettyunits   1.0.2     2015-07-13 [1] CRAN (R 3.5.0)
 processx      3.2.1     2018-12-05 [1] CRAN (R 3.5.0)
 ps            1.3.0     2018-12-21 [1] CRAN (R 3.5.0)
 purrr         0.3.0     2019-01-27 [1] CRAN (R 3.5.2)
 R6            2.3.0     2018-10-04 [1] CRAN (R 3.5.0)
 Rcpp          1.0.0     2018-11-07 [1] CRAN (R 3.5.1)
 remotes       2.0.2     2018-10-30 [1] CRAN (R 3.5.0)
 rlang         0.3.1     2019-01-08 [1] CRAN (R 3.5.2)
 rprojroot     1.3-2     2018-01-03 [1] CRAN (R 3.5.0)
 scales        1.0.0     2018-08-09 [1] CRAN (R 3.5.0)
 sessioninfo   1.1.1     2018-11-05 [1] CRAN (R 3.5.0)
 testthat      2.0.1     2018-10-13 [1] CRAN (R 3.5.0)
 tibble        2.0.1     2019-01-12 [1] CRAN (R 3.5.2)
 tidyselect    0.2.5     2018-10-11 [1] CRAN (R 3.5.0)
 usethis       1.4.0     2018-08-14 [1] CRAN (R 3.5.0)
 withr         2.1.2     2018-03-15 [1] CRAN (R 3.5.0)
 XML           3.98-1.16 2018-08-19 [1] CRAN (R 3.5.1)

[1] /Library/Frameworks/R.framework/Versions/3.5/Resources/library

It is possible that this is a mac-related compiler issue on my end but I also want to make sure this isn't a memory bug resulting from the Mojave release of macOS.

Thanks, Bryan

MarcLavielle commented 5 years ago

I don't know... this may happen if you have several versions of R installed on your computer (/Library/Frameworks/R.framework/Versions/) If that's the case, just keep one best, Marc

Le mer. 6 févr. 2019 à 21:22, Bryan Mayer notifications@github.com a écrit :

I was trying to run the tutorial code for using simulx http://monolix.lixoft.com/case-studies/tobramycin-case-study-part-5-dosing-regimen-simulations-with-simulx/ (downloaded the project scripts from this link http://dataset.lixoft.com/filesToWebsite/caseStudies/01_Tobramycin/simulx_forWebsite.zip) and it crashed my R session.

Code and error as follows:

setwd("~/simulx_forWebsite/simulx/")

library(mlxR)

Loading required package: ggplot2

project.file <- '../monolixProjects/project_07.mlxtran'

res1 <- simulx(project = project.file)

caught segfault

address 0x18, cause 'memory not mapped'

Traceback:

1: simulxunit(model = model, lv = lv, settings = settings, out.trt = out.trt, riov = riov)

2: simulx(project = project.file)

Possible actions:

1: abort (with core dump, if enabled)

2: normal R exit

3: exit R without saving workspace

4: exit R saving workspace

Selection:

(RStudio crashed without providing an error.)

I dug a little deeper using lldb

(lldb) process attach --name rsession --waitfor

libR.dylib was compiled with optimization - stepping may behave oddly; variables may not be available.

Process 24593 stopped

  • thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP

    frame #0: 0x0000000101262f9b libR.dylib`R_Parse1File at gram.c:3534 [opt]

Target 0: (rsession) stopped.

Executable module set to "/Applications/RStudio.app/Contents/MacOS/rsession".

Architecture set to: x86_64h-apple-macosx.

(lldb) c

Process 24593 resuming

libR.dylib was compiled with optimization - stepping may behave oddly; variables may not be available.

Process 24593 stopped

  • thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)

    frame #0: 0x000000010da37022 libR.dylib`GetNewPage(node_class=) at memory.c:895 [opt]

Target 0: (rsession) stopped.

(lldb) bt

  • thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x18)

    • frame #0: 0x000000010da37022 libR.dylib`GetNewPage(node_class=) at memory.c:895 [opt]

    frame #1: 0x000000010da3bad2 libR.dylib`Rf_allocVector3(type=13, length=, allocator=) at memory.c:2486 [opt]

    frame #2: 0x000000010d907d4f libR.dylib`get_package_CEntry_table [inlined] Rf_allocVector(type=13, length=1) at Rinlinedfuns.h:196 [opt]

    frame #3: 0x000000010d907d4a libR.dylib`get_package_CEntry_table [inlined] Rf_ScalarInteger(x=0) at Rinlinedfuns.h:594 [opt]

    frame #4: 0x000000010d907d4a libR.dylib`get_package_CEntry_table(package="Rcpp") at Rdynload.c:1415 [opt]

    frame #5: 0x000000010d907e06 libR.dylib`R_GetCCallable(package="Rcpp", name="enterRNGScope") at Rdynload.c:1440 [opt]

    frame #6: 0x000000010bee609e mlxComputeR.so`mlxComputeR + 78

    frame #7: 0x000000010120d48d libR.dylib`R_doDotCall(ofun=, nargs=, cargs=, call=0x000000010726c288) at dotcode.c:570 [opt]

    frame #8: 0x000000010120f333 libR.dylib`do_dotcall(call=0x000000010726c288, op=, args=, env=) at dotcode.c:1252 [opt]

    frame #9: 0x00000001012428de libR.dylib`bcEval(body=, rho=0x00000001072705d0, useCache=) at eval.c:6738 [opt]

    frame #10: 0x000000010123d7db libR.dylib`Rf_eval(e=, rho=) at eval.c:624 [opt]

    frame #11: 0x000000010125014c libR.dylib`R_execClosure(call=0x0000000108fab0b8, newrho=0x00000001072705d0, sysparent=, rho=, arglist=, op=) at eval.c:0 [opt]

    frame #12: 0x00000001012427f3 libR.dylib`bcEval(body=, rho=0x000000010ca5dd58, useCache=) at eval.c:6749 [opt]

    frame #13: 0x000000010123d7db libR.dylib`Rf_eval(e=, rho=) at eval.c:624 [opt]

    frame #14: 0x000000010125014c libR.dylib`R_execClosure(call=0x000000010ca140e8, newrho=0x000000010ca5dd58, sysparent=, rho=, arglist=, op=) at eval.c:0 [opt]

    frame #15: 0x000000010123dd0c libR.dylib`Rf_eval(e=0x000000010ca143c0, rho=0x0000000102046198) at eval.c:747 [opt]

    frame #16: 0x0000000101253169 libR.dylib`do_set(call=, op=0x0000000102802ee8, args=0x000000010ca14350, rho=0x0000000102046198) at eval.c:2787 [opt]

    frame #17: 0x000000010123d9ce libR.dylib`Rf_eval(e=, rho=0x0000000102046198) at eval.c:699 [opt]

    frame #18: 0x0000000101280bda libR.dylib`Rf_ReplIteration(rho=0x0000000102046198, savestack=, browselevel=0, state=0x00007ffeefbfc8b0) at main.c:258 [opt]

    frame #19: 0x00000001012821bf libR.dylib`run_Rmainloop [inlined] R_ReplConsole(rho=, savestack=0, browselevel=0) at main.c:308 [opt]

    frame #20: 0x0000000101282156 libR.dylib`run_Rmainloop at main.c:1082 [opt]

    frame #21: 0x00000001008522f9 rsession`rstudio::r::session::runEmbeddedR(rstudio::core::FilePath const&, rstudio::core::FilePath const&, bool, bool, SA_TYPE, rstudio::r::session::Callbacks const&, rstudio::r::session::InternalCallbacks*) + 425

    frame #22: 0x00000001008312fc rsession`rstudio::r::session::run(rstudio::r::session::ROptions const&, rstudio::r::session::RCallbacks const&) + 3164

    frame #23: 0x0000000100109063 rsession`main + 28963

    frame #24: 0x0000000100003cb4 rsession`start + 52

My session info prior to running the code:

library(mlxR)

Loading required package: ggplot2

devtools::session_info()

─ Session info ───────────────────────────────────────────────────────────────

setting value

version R version 3.5.1 (2018-07-02)

os macOS 10.14.3

system x86_64, darwin15.6.0

ui X11

language (EN)

collate en_US.UTF-8

ctype en_US.UTF-8

tz America/Los_Angeles

date 2019-02-06

─ Packages ───────────────────────────────────────────────────────────────────

package * version date lib source

assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.0)

backports 1.1.3 2018-12-14 [1] CRAN (R 3.5.0)

bindr 0.1.1 2018-03-13 [1] CRAN (R 3.5.0)

bindrcpp 0.2.2 2018-03-29 [1] CRAN (R 3.5.0)

callr 3.1.1 2018-12-21 [1] CRAN (R 3.5.0)

cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.0)

colorspace 1.4-0 2019-01-13 [1] CRAN (R 3.5.2)

crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.0)

desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.0)

devtools 2.0.1 2018-10-26 [1] CRAN (R 3.5.1)

digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.0)

dplyr 0.7.8 2018-11-10 [1] CRAN (R 3.5.1)

fs 1.2.6 2018-08-23 [1] CRAN (R 3.5.0)

ggplot2 * 3.1.0 2018-10-25 [1] CRAN (R 3.5.1)

glue 1.3.0 2018-07-17 [1] CRAN (R 3.5.0)

gtable 0.2.0 2016-02-26 [1] CRAN (R 3.5.0)

lazyeval 0.2.1 2017-10-29 [1] CRAN (R 3.5.0)

magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.0)

memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.0)

mlxR * 3.3.0 2018-02-20 [1] CRAN (R 3.5.1)

munsell 0.5.0 2018-06-12 [1] CRAN (R 3.5.0)

pillar 1.3.1 2018-12-15 [1] CRAN (R 3.5.0)

pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.0)

pkgconfig 2.0.2 2018-08-16 [1] CRAN (R 3.5.0)

pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.0)

plyr 1.8.4 2016-06-08 [1] CRAN (R 3.5.0)

prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.0)

processx 3.2.1 2018-12-05 [1] CRAN (R 3.5.0)

ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.0)

purrr 0.3.0 2019-01-27 [1] CRAN (R 3.5.2)

R6 2.3.0 2018-10-04 [1] CRAN (R 3.5.0)

Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.1)

remotes 2.0.2 2018-10-30 [1] CRAN (R 3.5.0)

rlang 0.3.1 2019-01-08 [1] CRAN (R 3.5.2)

rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.0)

scales 1.0.0 2018-08-09 [1] CRAN (R 3.5.0)

sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.0)

testthat 2.0.1 2018-10-13 [1] CRAN (R 3.5.0)

tibble 2.0.1 2019-01-12 [1] CRAN (R 3.5.2)

tidyselect 0.2.5 2018-10-11 [1] CRAN (R 3.5.0)

usethis 1.4.0 2018-08-14 [1] CRAN (R 3.5.0)

withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.0)

XML 3.98-1.16 2018-08-19 [1] CRAN (R 3.5.1)

[1] /Library/Frameworks/R.framework/Versions/3.5/Resources/library

It is possible that this is a mac-related compiler issue on my end but I also want to make sure this isn't a memory bug resulting from the Mojave release of macOS.

Thanks, Bryan

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/MarcLavielle/mlxR/issues/23, or mute the thread https://github.com/notifications/unsubscribe-auth/AJ3yupN9bZQPPRpCfDflgCIAdH5NFmSMks5vKzlugaJpZM4amCKk .

-- Marc Lavielle

CMAP, Ecole Polytechnique91128 Palaiseau Cedex

Francehttps://soutienvenezuela.org/en/ Tel: (33) 1 69 33 46 00 (33) 6 37 31 93 05

Marc.Lavielle@inria.fr http://www.cmap.polytechnique.fr/~lavielle

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""

mayerbry commented 5 years ago

That worked! thanks so much!

Solution: went to /Library/Frameworks/R.framework/Versions/ and deleted all R installations except most recent version and the current folder.