[Rcpp-devel] Rstudio crashes with repeated calls to sourceCpp with Xptr export

Dirk Eddelbuettel edd at debian.org
Mon Sep 4 14:32:13 CEST 2017


Hi Jouni,

On 4 September 2017 at 08:22, Helske, Jouni wrote:
| In the bssm package (https://github.com/helske/bssm), I let the users
| define a state space model via own C++ functions which are then exported as
| Xptr to R side, and passed back to C++ function for SMC/MCMC etc. Normally
| this works fine, but when user repeatedly modifies the model functions and
| re-exports them via repeated calls sourceCpp, sometimes whole Rstudio
| crashes.

Which version of RStudio?  See Help -> About

| I haven't been able to pinpoint the reason or minimal example. Have anyone else experienced similar issues or is it just me i.e. error in my own implementations?

There are a lot of dependencies here [re-indented by me]:

  Suggests: KFAS (>= 1.2.1), knitr (>= 1.11), rmarkdown (>= 0.8.1), testthat,
     bayesplot
  Imports: coda (>= 0.18-1), diagis, ggplot2 (>= 2.0.0), Rcpp (>= 0.12.3)
  LinkingTo: BH, Rcpp, RcppArmadillo, ramcmc, sitmo

We do know Boost interactions (between code compiled 'by us' as R extensions
using Boost, and RStudio itself also using an older version of Boost) had
thrown spanners in the past. A while back Kevin updated RStudio internals and
shielded "their" Boost better.

I happen to run RStudio "Daily" builds on all my machines -- those have the
fix and "behave". Maybe worth a try for you.
 
| Simplest case of this is the discretized SDE models, this is the function
| which user modifies:
| https://github.com/helske/bssm/blob/master/vignettes/sde_functions.cpp,
| <https://github.com/helske/bssm/blob/master/vignettes/sde_functions.cpp>
| and the relevant parts of the package codes are in src/function_pointers.h,
| src/sde_ssm.cpp and src/R_sde.cpp (I don't really expect anyone to read
| through all of these).

We'd probably need a reproducible example to really help.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org


More information about the Rcpp-devel mailing list