[R-pkg-devel] debugging memory errors

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Wed Nov 6 22:37:58 CET 2019


On 6 November 2019 at 08:43, Marcin Jurek wrote:
| 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

That is strange.

| 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

Because the r-devel-san Rocker container is already instrumented for (A)SAN
at the r-devel level, you do not have say it again in your src/Makevars.
This could be the source of you error here.  Then again, it could be
something else.

Generally, SAN/ASAN/UBSAN debugging can be tedious. I built the Rocker
container to reproduce a bug report I had at the time. The containers can
then slip behind in their config -- but there are alternative ones as has
been pointed out here: rhub is one, and I believe Winston et al also have one
in the rstudio container stack.  I used all of them, but at time still failed
to reproduce errors at CRAN.

In a world with more resources, someone somewhere could help CRAN to publish
their containers. Then we would have reproducibility.  Until then it is at
times more like poking with a stick ...

Dirk
 
| 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]]
| 
| ______________________________________________
| R-package-devel using r-project.org mailing list
| https://stat.ethz.ch/mailman/listinfo/r-package-devel

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



More information about the R-package-devel mailing list