[R-pkg-devel] Reproducing the clang-UBSAN test environment in rhub or somewhere else?
Dirk Eddelbuettel
edd @end|ng |rom deb|@n@org
Mon Nov 3 18:27:27 CET 2025
Peter,
Besides the comments Tomas already made, consider looking more closely at the
vignettes. The error in [0] indicates that this comes from vignettes, not
examples or tests.
I have been providing Docker containers for gcc and clang ASAN/UBSAN for what
must be close to a decade. These often work as they try to follow the setup
used by BDR on his machines. [1] When they fail the very useful 'sumo'
container by Winston often referenced here in threads can also be useful.
So as a test, I pulled a refreshed version of the rocker/r-devel-san
container [2] and installed the (considerable) dependency set of your
packages. As expected, nothing in tests or examples. I then purl'ed the code
out of the vignettes and ran those, and that seems to replicate the issue:
../../src/tbbmalloc/backref.cpp:150:21: runtime error: index 1 out of bounds for type 'BackRefBlock *[1]'
Fitting rank-6 Poisson NMF to 100 x 16791 sparse matrix.
Running at most 20 SCD updates, without extrapolation (fastTopics 0.7-30).
/usr/local/lib/R/site-library/RcppArmadillo/include/current/armadillo_bits/Mat_meat.hpp:7043:26: runtime error: reference binding to null pointer of type 'const double'
/usr/local/lib/R/site-library/RcppArmadillo/include/current/armadillo_bits/access.hpp:26:100: runtime error: reference binding to null pointer of type 'double'
/usr/local/lib/R/site-library/RcppArmadillo/include/current/armadillo_bits/Mat_meat.hpp:7043:26: runtime error: reference binding to null pointer of type 'const double'
/usr/local/lib/R/site-library/RcppArmadillo/include/current/armadillo_bits/access.hpp:26:100: runtime error: reference binding to null pointer of type 'double'
/usr/local/lib/R/site-library/RcppArmadillo/include/current/armadillo_bits/subview_meat.hpp:1420:54: runtime error: reference binding to null pointer of type 'const double'
/usr/local/lib/R/site-library/RcppArmadillo/include/current/armadillo_bits/access.hpp:26:100: runtime error: reference binding to null pointer of type 'double'
This could be an upstream issue is Armadillo as wrapped in RcppArmadillo. I
as maintainer need to balance the (frequent) updates upstream with the CRAN
Policy of "no more than six releases in six month" so I have sat out the bug
fix release 15.0.3 as well as the new releases 15.2 and 15.2.1 and not
uploaded them to CRAN. However, they are packaged at my master branch and
available via R-universe.
So as a test I fetched 15.2.1 from there, installed it, re-installed your
package and ran the test again. The errors persist suggesting it may be your
code and it creates matrices or matrix views. (Needless to say, the error
could of course also be on our end in RcppArmadillo.)
Would it be possible to simplify the code down to a simpler, self-contained
matrix example not requiring all the packages? That would also make testing
with the other container quicker as we would not have to reinstall all those
dependencies.
Another possibility is parallelism as the message comes from tbbmalloc so
maybe trying in serial mode may help?
Lastly, as you asked about rhub: I am not involved with rhub and do not use
it much myself so I cannot help much on that aspect. But if this does not
replicate under their container you should be able to hook up the one used
here, i.e. rocker/r-devel-san (as well as the other one) under GitHub Actions
as they let you pull in other Docker containers (when running under Linux).
It's too nice outside right now here in Chicagoland so I'll now disappear for
a bit on my bike but we can possibly pick this up later.
Cheers, Dirk
[0] https://www.stats.ox.ac.uk/pub/bdr/memtests/clang-UBSAN/fastTopics/build_vignettes.log
[1] In a more ideal world, his tests could be based on containers and these
containers could be provided. Alas, on this planet we're not there yet.
[2] Both containers are refreshed regularly via schedule GitHub Actions.
--
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
More information about the R-package-devel
mailing list