← All tasks
cpplightgbm-org/LightGBM #6628Not a task: already works

[ci] [R-package] macOS clang CMake jobs failing with segfaults

envgap__lightgbm-org__LightGBM-6628

01 / FAILURE SIGNATURE

As reported upstream

* checking examples ... ERROR
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
fde01573c3500d557cff91c900e8e0968a7a5ddd
Manifest
CMakeLists.txt
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

lightgbm-org/LightGBM #6628 · read the original issue
## Description



The `r-package (macos-13, clang, R 4.3, cmake)` CI jobs are failing with a segfault like this:



```text

* checking examples ... ERROR

Running examples in ‘lightgbm-Ex.R’ failed

The error most likely occurred in:



> base::assign(".ptime", proc.time(), pos = "CheckExEnv")

> ### Name: lgb.cv

> ### Title: Main CV logic for LightGBM

> ### Aliases: lgb.cv

> 

> ### ** Examples

> 

> ## No test: 

> ## Don't show: 

> setLGBMthreads(2L)

> ## End(Don't show)

> ## Don't show: 

> data.table::setDTthreads(1L)

> ## End(Don't show)

> data(agaricus.train, package = "lightgbm")



 *** caught segfault ***

address 0x540, cause 'memory not mapped'



Traceback:

 1: load(zfile, envir = tmp_env)

 2: data(agaricus.train, package = "lightgbm")

An irrecoverable exception occurred. R is aborting now ...

* checking for unstated dependencies in ‘tests’ ... OK

* checking tests ...

  Running ‘testthat.R’/Library/Frameworks/R.framework/Resources/bin/BATCH: line 60: 12462 Segmentation fault: 11  ${R_HOME}/bin/R -f ${in} ${opts} ${R_BATCH_OPTIONS} > ${out} 2>&1

 [20s/12s]

 [20s/12s] ERROR

Running the tests in ‘tests/testthat.R’ failed.

Last 13 lines of output:

  

   *** caught segfault ***

  address 0x7fb41c[2000](https://github.com/microsoft/LightGBM/actions/runs/10581950637/job/29392431659?pr=6625#step:9:2001)34, cause 'memory not mapped'

  Warning: stack imbalance in 'lazyLoadDBfetch', 15 then 17

  Warning: stack imbalance in 'c', 40 then 38

  Warning: stack imbalance in 'lapply', 16 then 17

  

  Traceback:

   1: (function () expr)()

   2: test_files_serial(test_dir = test_dir, test_package = test_package,     test_paths = test_paths, load_helpers = load_helpers, reporter = reporter,     env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     desc = desc, load_package = load_package, error_call = error_call)

   3: test_files(test_dir = path, test_paths = test_paths, test_package = package,     reporter = reporter, load_helpers = load_helpers, env = env,     stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     load_package = load_package, parallel = parallel)

   4: test_dir("testthat", package = package, reporter = reporter,     ..., load_package = "installed")

   5: test_check(package = "lightgbm", stop_on_failure = TRUE, stop_on_warning = FALSE,     reporter = testthat::SummaryReporter$new())

  An irrecoverable exception occurred. R is aborting now ...

  Execution halted

* checking for unstated dependencies in vignettes ... OK

* checking package vignettes in ‘inst/doc’ ... OK

sh: line 1: 12492 Segmentation fault: 11  R_LIBS=/var/folders/zf/5wcpcvh91p9g4jn5srhsmzv40000gn/T//Rtmpr6e2Sh/RLIBS_29c22c8c2289 R_ENVIRON_USER='' R_LIBS_USER='NULL' R_LIBS_SITE='NULL' '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla --no-echo > '/Users/runner/work/LightGBM/LightGBM/lightgbm.Rcheck/build_vignettes.log' 2>&1 < '/var/folders/zf/5wcpcvh91p9g4jn5srhsmzv40000gn/T//Rtmpr6e2Sh/file29c23693a3f9'

* checking re-building of vignette outputs ... ERROR

Error(s) in re-building vignettes:

  ...

--- re-building ‘basic_walkthrough.Rmd’ using knitr

```



## Reproducible example



This is happening on all PRs. For example, see this build from #6625: https://github.com/microsoft/LightGBM/actions/runs/10581950637/job/29392431659?pr=6625.



On that PR, I manually re-triggered that job 3 times over the last 24 hours.



## Additional Comments



It's worth noting that:



* all other R jobs are passing (including multiple on macOS, across multiple R versions)

* all non-R CI jobs (including swig, Python, and C++ tests) are passing, many also with CMake + clang

* this job uses a fixed version of R (4.3.1) ... new changes in R-devel couldn't cause this

* there are 0 issues reported in the CRAN checks on `{lightgbm}` v4.5.0: https://cran.r-project.org/web/checks/check_results_lightgbm.html
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]