[R-pkg-devel] debugging memory errors

Marcin Jurek m@rc|njurek1988 @end|ng |rom gm@||@com
Wed Nov 6 15:43:50 CET 2019


Hello, I'm trying to submit my package to CRAN and received the following
error message:

Error(s) in re-building vignettes:
--- re-building ‘GPvecchia_vignette.Rmd’ using rmarkdown
.../RcppArmadillo/include/armadillo_bits/subview_meat.hpp:1223:54:
runtime error: reference binding to null pointer of type 'const unsigned
int'
...//RcppArmadillo/include/armadillo_bits/access.hpp:26:100: runtime
error: reference binding to null pointer of type 'unsigned int'
=================================================================
==40666==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x615000445e48 at pc 0x7faebceeaa54 bp 0x7ffd4d87a980 sp 0x7ffd4d87a970
READ of size 8 at 0x615000445e48 thread T0
     #0 0x7faebceeaa53 in createUcpp(Rcpp::Vector<14,
Rcpp::PreserveStorage>, Rcpp::Vector<14, Rcpp::PreserveStorage>,
arma::Mat<double>, arma::Col<double>)
/data/gannet/ripley/R/packages/incoming/GPvecchia.Rcheck/00_pkg_src/GPvecchia/src/U_NZentries.cpp:366
     #1 0x7faebce84b2d in _GPvecchia_createUcpp
/data/gannet/ripley/R/packages/incoming/GPvecchia.Rcheck/00_pkg_src/GPvecchia/src/RcppExports.cpp:118

I have very little clue what to do, above all because I don't know how to
reproduce the error. Here is what I tried:
1. Using the r-devel-san container from rocker. When I'm building the
package using
> RD CMD build GPvecchia
it tells me:

Error: package or namespace load failed for ‘GPvecchia’ in dyn.load(file,
DLLpath = DLLpath, ...):
 unable to load shared object
'/tmp/RtmpRfO4Ad/Rinst96f4db205fe/00LOCK-GPvecchia/00new/GPvecchia/libs/GPvecchia.so':

/tmp/RtmpRfO4Ad/Rinst96f4db205fe/00LOCK-GPvecchia/00new/GPvecchia/libs/GPvecchia.so:
undefined symbol: __asan_option_detect_stack_use_after_return

Here is the package Makevars (following the specification from
https://www.stats.ox.ac.uk/pub/bdr/memtests/README.txt):
## optional
CXX_STD = CXX11

#PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) -lasan
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -fsanitize=address,undefined
-fno-omit-frame-pointer -fno-sanitize=vptr
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

MAIN_LDFLAGS=-fsanitize=address,undefined -pthread

F77 = gfortran -fsanitize=address
FC = gfortran -fsanitize=address
FCFLAGS = -g -O2 -mtune=native
FFLAGS = -g -O2 -mtune=native

2. I also tried using r-hub and their platform with R compiled with the
appropriate flags. However, their configuration does not support openMP.

Please help, thanks!

Marcin

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list