Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misaligned address sanitizer errors with csr_matrix_times_vector() - leading to CRAN package failing additional tests #1111

Open
dmphillippo opened this issue Jan 26, 2024 · 25 comments

Comments

@dmphillippo
Copy link

Summary:

Sparse matrix arithmetic using csr_matrix_times_vector() seems to trigger sanitizer "misaligned address" errors.

Description:

My package multinma that fits models using rstan has been flagged as failing additional tests in gcc-UBSAN. Closer inspection seems to point to csr_matrix_times_vector() as the cause.

I have also opened a thread on discourse.

Reproducible Steps:

This small model recreates the sanitizer errors:

library(rstan)

mod <- "
data {
  int n;
  matrix[n, n] M;
}
transformed data {
  int nz = num_elements(csr_extract_w(M));
  vector[nz] Mw = csr_extract_w(M);
  array[nz] int Mv = csr_extract_v(M);
  array[n + 1] int Mu = csr_extract_u(M);
}
parameters {
  vector[n] x;
}
transformed parameters {
  vector[n] y = csr_matrix_times_vector(n, n, Mw, Mv, Mu, x);
}
model {
  x ~ std_normal();
}
"

stan(model_code = mod,
     data = list(
       n = 2,
       M = matrix(c(1, 0.5, 0.5, 1), nrow = 2, ncol = 2)
     ),
     test_grad = TRUE)

Commenting out the transformed parameter removes the sanitizer warnings, so this seems to be a problem with csr_matrix_times_vector().

Current Output:

Details

TESTING GRADIENT FOR MODEL 'anon_model' NOW (CHAIN 1).
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:852:18: runtime error: reference binding to misaligned address 0x5556fef3455c for type 'struct Scalar', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 00 00 00 00  b0 1b a4 f9 56 55 00 00  20 4b 9e f9 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/AssignEvaluator.h:637:26: runtime error: reference binding to misaligned address 0x5556fef3455c for type 'struct var_value', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 00 00 00 00  b0 1b a4 f9 56 55 00 00  20 4b 9e f9 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/functors/AssignmentFunctors.h:24:100: runtime error: store to misaligned address 0x5556fef3455c for type 'struct var_value', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 00 00 00 00  b0 1b a4 f9 56 55 00 00  20 4b 9e f9 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:840:18: runtime error: reference binding to misaligned address 0x5556fef3455c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 d0 40 f3 fe  56 55 00 00 e8 40 f3 fe  56 55 00 00 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:549:21: runtime error: reference binding to misaligned address 0x5556fef3455c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 d0 40 f3 fe  56 55 00 00 e8 40 f3 fe  56 55 00 00 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/fun/value_of.hpp:25: runtime error: member access within misaligned address 0x5556fef3455c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 d0 40 f3 fe  56 55 00 00 e8 40 f3 fe  56 55 00 00 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/fun/value_of.hpp:25: runtime error: member access within misaligned address 0x5556fef3455c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 d0 40 f3 fe  56 55 00 00 e8 40 f3 fe  56 55 00 00 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:852:18: runtime error: reference binding to misaligned address 0x5556fef3457c for type 'struct Scalar', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/AssignEvaluator.h:637:26: runtime error: reference binding to misaligned address 0x5556fef3457c for type 'struct var_value', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/var.hpp:82: runtime error: constructor call on misaligned address 0x5556fef3458c for type 'struct vari_type', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/vari.hpp:126: runtime error: member access within misaligned address 0x5556fef3458c for type 'struct vari_value', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/vari.hpp:126: runtime error: member access within misaligned address 0x5556fef3458c for type 'struct vari_value', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 00 00 00 00  00 00 00 00 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/vari.hpp:126: runtime error: constructor call on misaligned address 0x5556fef3458c for type 'struct vari_base', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 00 00 00 00  00 00 00 00 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/vari.hpp:28: runtime error: member access within misaligned address 0x5556fef3458c for type 'struct vari_base', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 00 00 00 00  00 00 00 00 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/vari.hpp:126: runtime error: member access within misaligned address 0x5556fef3458c for type 'struct vari_value', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 b0 3f 14 7c  5d 7f 00 00 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/vari.hpp:126: runtime error: member access within misaligned address 0x5556fef3458c for type 'struct vari_value', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 d0 3f 14 7c  5d 7f 00 00 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/vari.hpp:126: runtime error: member access within misaligned address 0x5556fef3458c for type 'struct vari_value', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8  b8 b8 ea 3f 56 55 00 00  70 c0 9d f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/rev/core/vari.hpp:130: runtime error: member access within misaligned address 0x5556fef3458c for type 'struct vari_value', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  70 c0 9d f9 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8  b8 b8 ea 3f 00 00 00 00  00 00 00 00 56 55 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/functors/AssignmentFunctors.h:24:100: runtime error: store to misaligned address 0x5556fef3457c for type 'struct var_value', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 56 55 00 00  70 c0 9d f9 56 55 00 00  70 c0 9d f9 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:840:18: runtime error: reference binding to misaligned address 0x5556fef3457c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 8c 45 f3 fe  56 55 00 00 a4 45 f3 fe  56 55 00 00 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/AssignEvaluator.h:637:26: runtime error: reference binding to misaligned address 0x5556fef3457c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 8c 45 f3 fe  56 55 00 00 a4 45 f3 fe  56 55 00 00 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/functors/AssignmentFunctors.h:24:100: runtime error: load of misaligned address 0x5556fef3457c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 8c 45 f3 fe  56 55 00 00 a4 45 f3 fe  56 55 00 00 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:834:18: runtime error: reference binding to misaligned address 0x5556fef3457c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 8c 45 f3 fe  56 55 00 00 a4 45 f3 fe  56 55 00 00 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:774:21: runtime error: reference binding to misaligned address 0x5556fef3457c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 8c 45 f3 fe  56 55 00 00 a4 45 f3 fe  56 55 00 00 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/eigen_plugins.h:160:41: runtime error: member access within misaligned address 0x5556fef3457c for type 'const struct var_value', which requires 8 byte alignment
0x5556fef3457c: note: pointer points here
  60 bd 9d f9 8c 45 f3 fe  56 55 00 00 a4 45 f3 fe  56 55 00 00 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/eigen_plugins.h:160:46: runtime error: member access within misaligned address 0x5556fef3458c for type 'struct vari_type', which requires 8 byte alignment
0x5556fef3458c: note: pointer points here
  56 55 00 00 d0 3f 14 7c  5d 7f 00 00 27 1c f4 c8  b8 b8 ea 3f 00 00 00 00  00 00 00 00 d0 3f 14 7c
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/eigen_plugins.h:160:46: runtime error: reference binding to misaligned address 0x5556fef3459c for type 'const double', which requires 8 byte alignment
0x5556fef3459c: note: pointer points here
  b8 b8 ea 3f 00 00 00 00  00 00 00 00 d0 3f 14 7c  5d 7f 00 00 40 bf c4 63  46 6c 9d bf 00 00 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:774:47: runtime error: reference binding to misaligned address 0x5556fef3459c for type 'const double', which requires 8 byte alignment
0x5556fef3459c: note: pointer points here
  b8 b8 ea 3f 00 00 00 00  00 00 00 00 d0 3f 14 7c  5d 7f 00 00 40 bf c4 63  46 6c 9d bf 00 00 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:100:67: runtime error: reference binding to misaligned address 0x5556fef3459c for type 'const double', which requires 8 byte alignment
0x5556fef3459c: note: pointer points here
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/SparseCore/SparseDenseProduct.h:100:96: runtime error: load of misaligned address 0x5556fef3459c for type 'const double', which requires 8 byte alignment
0x5556fef3459c: note: pointer points here
  b8 b8 ea 3f 00 00 00 00  00 00 00 00 d0 3f 14 7c  5d 7f 00 00 40 bf c4 63  46 6c 9d bf 00 00 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:852:18: runtime error: reference binding to misaligned address 0x5556fef3455c for type 'struct Scalar', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 d0 40 f3 fe  56 55 00 00 e8 40 f3 fe  56 55 00 00 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/CoreEvaluators.h:792:21: runtime error: reference binding to misaligned address 0x5556fef3455c for type 'struct var_value', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 d0 40 f3 fe  56 55 00 00 e8 40 f3 fe  56 55 00 00 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^
/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/eigen_plugins.h:160:41: runtime error: member access within misaligned address 0x5556fef3455c for type 'struct var_value', which requires 8 byte alignment
0x5556fef3455c: note: pointer points here
  04 00 00 00 d0 40 f3 fe  56 55 00 00 e8 40 f3 fe  56 55 00 00 56 55 00 00  b8 da 9f f9 56 55 00 00
              ^

TESTING GRADIENT FOR MODEL 'anon_model' NOW (CHAIN 2).

TESTING GRADIENT FOR MODEL 'anon_model' NOW (CHAIN 3).

TESTING GRADIENT FOR MODEL 'anon_model' NOW (CHAIN 4).

RStan Version:

> packageVersion("rstan")
[1] ‘2.32.5’

R Version:

Issue recreated using the rocker/r-devel-san docker container, which builds r-devel with compiler sanitizers.

> R.version.string
[1] "R Under development (unstable) (2024-01-22 r85820)"

Operating System:

Linux run in rocker/r-devel-san docker container. Issue first appeared on CRAN gcc-UBSAN test environment (also a flavour of linux).

@WardBrian
Copy link
Member

WardBrian commented Jan 26, 2024

I believe I have found the source of this in the Stan Math library. This function allocates u onto our autodiff stack, but in because u is of length 3 in this case, and sizeof(int) == 4, the autodiff stack pointer is moved forward 12 bytes. The next allocation is then not aligned to a multiple of 8

@dmphillippo
Copy link
Author

Aha! That might explain why I could make the sanitizer error disappear by adding/removing certain rows of data but not others. When the data structure results in M having nz non-zero entries so that nz * 4 is a multiple of 8 I don't get the error. But when nz * 4 is not a multiple of 8 I do get the error.

I'm guessing any fix will take a little while to make it to CRAN, if it's an issue all the way upstream in Stan Math? I have until 2024-02-08 to resolve the error before I'm threatened with removal of my package, but I'll try to argue the case for retaining my package whilst this is fixed upstream.

Thank you so much for looking into this!

@WardBrian
Copy link
Member

Hopefully the fix is small enough that the RStan team can backport it sooner

@WardBrian
Copy link
Member

@bgoodri I think it should be safe to cherry-pick the changes from stan-dev/math#3014 back to earlier versions to resolve this for rstan

@bgoodri
Copy link
Contributor

bgoodri commented Jan 29, 2024

I'll try the backport

@dmphillippo
Copy link
Author

Thanks both. CRAN didn't respond to my emails and have now just archived multinma, which is rather frustrating.

Any news on if/when the backport is likely to be possible? If not I might submit an update to CRAN that temporarily avoids running the affected tests, it's not ideal but better than remaining archived.

Happy to help in any way I can; I could run the sanitizer checks on a release candidate if that would be useful? Thanks again 🙂

dmphillippo added a commit to dmphillippo/multinma that referenced this issue Feb 15, 2024
@ConnorDonegan
Copy link

I also got an e-mail from CRAN warning that geostan will be taken down if not fixed by feb 29 2024. It has an installation error and a note about gcc-UBSAN.

I haven't had a chance to look closely yet but the installation error is coming after a matrix-vector product, so presumably this is connected to the same issue as @dmphillippo.

https://cran.r-project.org/web/checks/check_results_geostan.html

/home/hornik/tmp/R.check/r-release-gcc/Work/build/Packages/RcppEigen/include/Eigen/src/Core/products/SelfadjointMatrixVector.h:39:24: note: by argument 4 of type ‘const double*’ to ‘static void Eigen::internal::selfadjoint_matrix_vector_product<Scalar, Index, StorageOrder, UpLo, ConjugateLhs, ConjugateRhs, Version>::run(Index, const Scalar*, Index, const Scalar*, Scalar*, Scalar) [with Scalar = double; Index = long int; int StorageOrder = 0; int UpLo = 1; bool ConjugateLhs = false; bool ConjugateRhs = false; int Version = 0]’ declared here
   39 | EIGEN_DONT_INLINE void selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,Version>::run(
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [/home/hornik/tmp/R.check/r-release-gcc/Work/build/etc/Makeconf:196: stanExports_foundation.o] Terminated

@WardBrian
Copy link
Member

@ConnorDonegan your CRAN note calls out csr_matrix_times_vector in the back trace so I'd say it is almost certainly the same issue.

@ConnorDonegan
Copy link

Okay, and I see the changes here stan-dev/math#3014 have already been merged into the development branch, thanks @WardBrian. I have a couple weeks before geostan gets removed from CRAN, should I expect to see the changes released before then?

@bgoodri
Copy link
Contributor

bgoodri commented Feb 15, 2024 via email

@bgoodri
Copy link
Contributor

bgoodri commented Feb 15, 2024 via email

@dmphillippo
Copy link
Author

I see StanHeaders 2.32.6 is up on CRAN now, I take it this contains the backported fix?

@bgoodri
Copy link
Contributor

bgoodri commented Mar 4, 2024

Yes, and the min/max thing.

@ConnorDonegan
Copy link

I notice that the multinma and geostan packages have install errors now on CRAN, listed as of 2024-04-04 23:03:26 CEST (...just now)

This looks like the same issue again:

/home/hornik/tmp/R.check/r-release-gcc/Work/build/Packages/RcppEigen/include/Eigen/src/Core/products/SelfadjointMatrixVector.h:41:6: note: by argument 4 of type ‘const double*’ to ‘static void Eigen::internal::selfadjoint_matrix_vector_product<Scalar, Index, StorageOrder, UpLo, ConjugateLhs, ConjugateRhs, Version>::run(Index, const Scalar*, Index, const Scalar*, Scalar*, Scalar) [with Scalar = double; Index = long int; int StorageOrder = 0; int UpLo = 1; bool ConjugateLhs = false; bool ConjugateRhs = false; int Version = 0]’ declared here 41 | void selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,Version>::run( | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[1]: *** [/home/hornik/tmp/R.check/r-release-gcc/Work/build/etc/Makeconf:196: stanExports_foundation.o] Terminated
https://cloud.r-project.org/web/checks/check_results_geostan.html

https://cran.r-project.org/web/checks/check_results_multinma.html

@bgoodri
Copy link
Contributor

bgoodri commented Apr 5, 2024

I am not sure that it is the same error as the alignment thing in the OP (that was fixed). The geostan and multinma packages look like they might just be timing out on the CRAN server builds.

@ConnorDonegan
Copy link

The reason I thought it may be connected to this issue is that they're both terminating on matrix vector products again

multinma:
/home/hornik/tmp/R.check/r-patched-gcc/Work/build/Packages/RcppEigen/include/Eigen/src/Core/products/TriangularMatrixVector.h:105:24**: note: by argument 5 of type ‘const double*’ to ‘static void Eigen::internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, 1, Version>::run(Index, Index, const LhsScalar*, Index, const RhsScalar*, Index, ResScalar*, Index, const ResScalar&) [with Index = long int; int Mode = 6; LhsScalar = double; bool ConjLhs = false; RhsScalar = double; bool ConjRhs = false; int Version = 0]’ declared here 105 | EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor,Version> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[1]: *** [/home/hornik/tmp/R.check/r-patched-gcc/Work/build/etc/Makeconf:200: stanExports_survival_mspline.o] Terminated

@WardBrian
Copy link
Member

The original issue was about a runtime error, this seems to be different

@dmphillippo
Copy link
Author

multinma is now failing again the UBSAN tests on CRAN, with what looks like the same issue: https://www.stats.ox.ac.uk/pub/bdr/memtests/gcc-UBSAN/multinma/tests/testthat.Rout

Installing the latest StanHeaders 2.32.7, the small reprex in the first post recreates the errors in rocker/r-devel-san.

Downgrading to StanHeaders 2.32.6 doesn't give the UBSAN errors.

Is it possible that the latest 2.32.7 StanHeaders missed including this patch?

I have been given until 2024-05-22 to have this fixed before multinma is archived again.

@WardBrian
Copy link
Member

@dmphillippo yes, it appears that SH 2.32.7 is missing the patch to stan/math/rev/memory/stack_alloc.hpp

@bgoodri the changes to min/max (stan-dev/math#3024) also look like they got dropped from 2.32.7

@bgoodri
Copy link
Contributor

bgoodri commented May 8, 2024

I'll fix it

@dmphillippo
Copy link
Author

Thanks @bgoodri! Any chance this will be patched on CRAN by 22nd? I appreciate it must take a while getting through all the revdep checks etc.

@dmphillippo
Copy link
Author

dmphillippo commented May 21, 2024

I see StanHeaders 2.32.8 is on CRAN now, but I'm still seeing the sanitizer errors with this version. I think that the stack_alloc patch may still be missing? The other min/max patch does seem to be in this version, from what I can tell. Sorry!

@dmphillippo
Copy link
Author

@bgoodri just to follow up on this, the multinma and geostan packages are now both archived from CRAN due to the sanitiser warnings. As far as I can tell StanHeaders 2.32.8 is still missing the patch from stan-dev/math#3014 that was added in 2.32.6 to fix this - @WardBrian may be able to confirm?

@WardBrian
Copy link
Member

2.32.8's source code seems to be missing stan-dev/math#3014, but does include stan-dev/math#3024

@bgoodri
Copy link
Contributor

bgoodri commented Jun 1, 2024

@dmphillippo StanHeaders 2.32.9 on CRAN now has the padding fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants