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

[ci] use a suppression file with valgrind checks #6231

Open
jameslamb opened this issue Dec 12, 2023 · 0 comments
Open

[ci] use a suppression file with valgrind checks #6231

jameslamb opened this issue Dec 12, 2023 · 0 comments

Comments

@jameslamb
Copy link
Collaborator

Summary

This project occasionally runs valgrind to check for memory management issues.

Those checks are currently run only on the code paths touched by the R package's tests. It generates a few false positives, and those are currently prevented from failing the relevant CI job via text-parsing in a shell script.

A valgrind suppression file should be used for that purpose instead.

Motivation

  • allows for finer-grained control over which errors from valgrind the project regards as noteworthy
  • makes the configuration portable outside of using R to run valgrind

Description

To fix this, remove this stuff:

# one error caused by a false positive between valgrind and openmp is allowed
# ==2063== 352 bytes in 1 blocks are possibly lost in loss record 153 of 2,709
# ==2063== at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
# ==2063== by 0x40149CA: allocate_dtv (dl-tls.c:286)
# ==2063== by 0x40149CA: _dl_allocate_tls (dl-tls.c:532)
# ==2063== by 0x5702322: allocate_stack (allocatestack.c:622)
# ==2063== by 0x5702322: pthread_create@@GLIBC_2.2.5 (pthread_create.c:660)
# ==2063== by 0x56D0DDA: ??? (in /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0)
# ==2063== by 0x56C88E0: GOMP_parallel (in /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0)
# ==2063== by 0x1544D29C: LGBM_DatasetCreateFromCSC (c_api.cpp:1286)
# ==2063== by 0x1546F980: LGBM_DatasetCreateFromCSC_R (lightgbm_R.cpp:91)
# ==2063== by 0x4941E2F: R_doDotCall (dotcode.c:634)
# ==2063== by 0x494CCC6: do_dotcall (dotcode.c:1281)
# ==2063== by 0x499FB01: bcEval (eval.c:7078)
# ==2063== by 0x498B67F: Rf_eval (eval.c:727)
# ==2063== by 0x498E414: R_execClosure (eval.c:1895)
bytes_possibly_lost=$(
cat ${VALGRIND_LOGS_FILE} \
| grep -E "possibly lost\: .*" \
| sed 's/^.*possibly lost\: \(.*\) bytes.*$/\1/' \
| tr -d ","
)

And instead check in a file, .ci/valgrind.supp, into the repo which suppresses those specific errors.

To test, run the valgrind checks in a container, following https://github.com/microsoft/LightGBM/tree/master/R-package#valgrind.

References

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

No branches or pull requests

1 participant