В Fri, 9 May 2025 04:22:52 +0000
jiaming yuan <jm.y...@outlook.com> пишет:

> We are trying to resolve the test failures of XGBoost but so far no
> one has managed to reproduce them locally.
> https://github.com/dmlc/xgboost/issues/11431

One test failure really stands out:

>   Error ('test_feature_weights.R:17:5'): training with feature
> weights works
>   Error in `setinfo.xgb.DMatrix(dmat, names(p), p[[1]])`:
> cannot get data pointer of 'double' objects

This is particularly strange because the internal CHKVEC() function is
supposed to check for REALSXP vectors and pass them through. Such
"impossible" errors could be signs of a protection error. (Well, any
memory corruption, but arbitrary memory corruption is harder to
diagnose, so let's hope it's something to do with the garbage
collector.) Let's run the test suite check using a build of R-devel
compiled with .../configure --enable-strict-barrier.


testthat::test_check("xgboost")
# <...>
# Fatal error: Wrong thread calling 'RunFinalizers'
# Fatal error: Wrong thread calling 'RunFinalizers'
# Fatal error: Wrong thread calling 'RunFinalizers'
# Fatal error: Wrong thread calling 'RunFinalizers'
# Fatal error: Wrong thread calling 'RunFinalizers'
# Segmentation fault

Hmm.

Setting a breakpoint in Rstd_Suicide reveals the mistake. It's not a
protection error; it's R API being called from an OpenMP thread:

#5  ALTVEC_DATAPTR (x=0x2d825f58) at ../../../R/src/main/altrep.c:376
#6  0x00007fbbd1e5ed98 in operator() (__closure=<synthetic pointer>,
    i=<optimized out>) at xgboost_R.cc:258
#7  dmlc::OMPException::Run<XGDMatrixSetInfo_R(SEXP, SEXP, 
SEXP)::<lambda(xgboost::omp_ulong)>, int> (this=0x7fffbfaef760, f=...)
    at ./dmlc-core/include/dmlc/common.h:67
#8  
_ZN7xgboost6common11ParallelForIiZ18XGDMatrixSetInfo_REUlmE0_EEvT_iNS0_5SchedET0_._omp_fn.3(void)
 ()
    at ./dmlc-core/include/../../src/common/threading_utils.h:208
#9  0x00007fbbd4552a0e in gomp_thread_start (xdata=<optimized out>)
    at ../../../libgomp/team.c:129
(gdb) frame 5
#5  ALTVEC_DATAPTR (x=0x2d825f58) at ../../../R/src/main/altrep.c:376
376         return ALTVEC_DATAPTR_EX(x, TRUE);
(gdb) call R_inspect(x)
@2d825f58 14 REALSXP g0c0 [REF(65535)]  1 : 9 (expanded)

The code would be better served by calling REAL_RO / INTEGER_RO once
and then using the returned pointer inside the OpenMP threads.

-- 
Best regards,
Ivan

______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel

Reply via email to