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

[R-package] invalid read detected by valgrind #3525

Closed
jameslamb opened this issue Nov 3, 2020 · 2 comments · Fixed by #3526
Closed

[R-package] invalid read detected by valgrind #3525

jameslamb opened this issue Nov 3, 2020 · 2 comments · Fixed by #3526

Comments

@jameslamb
Copy link
Collaborator

Based on the result of a recent run of the valgrind job (https://github.com/microsoft/LightGBM/runs/1349685476?check_suite_focus=true), it looks like recent commits have introduced an illegal read.

==2055== Invalid read of size 1
==2055==    at 0x15335D0F: LightGBM::LeafSplits::Init(float const*, float const*) (leaf_splits.hpp:74)
==2055==    by 0x15329D9E: LightGBM::SerialTreeLearner::BeforeTrain() (serial_tree_learner.cpp:264)
==2055==    by 0x153296B3: LightGBM::SerialTreeLearner::Train(float const*, float const*) (serial_tree_learner.cpp:166)
==2055==    by 0x151A0A56: LightGBM::GBDT::TrainOneIter(float const*, float const*) (gbdt.cpp:379)
==2055==    by 0x15458612: LightGBM::Booster::TrainOneIter(float const*, float const*) (c_api.cpp:364)
==2055==    by 0x15449C4E: LGBM_BoosterUpdateOneIterCustom (c_api.cpp:1634)
==2055==    by 0x1546C469: LGBM_BoosterUpdateOneIterCustom_R (lightgbm_R.cpp:417)
==2055==    by 0x4941BDA: R_doDotCall (dotcode.c:610)
==2055==    by 0x494CCC6: do_dotcall (dotcode.c:1281)
==2055==    by 0x499FB01: bcEval (eval.c:7078)
==2055==    by 0x498B67F: Rf_eval (eval.c:727)
==2055==    by 0x498E414: R_execClosure (eval.c:1895)
==2055==  Address 0x8570974 is 260 bytes inside a block of size 1,512 free'd
==2055==    at 0x483CFBF: operator delete(void*) (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==2055==    by 0x151AA06F: std::default_delete<LightGBM::Config>::operator()(LightGBM::Config*) const (unique_ptr.h:85)
==2055==    by 0x151AA6FA: std::__uniq_ptr_impl<LightGBM::Config, std::default_delete<LightGBM::Config> >::reset(LightGBM::Config*) (unique_ptr.h:182)
==2055==    by 0x151A93C6: std::unique_ptr<LightGBM::Config, std::default_delete<LightGBM::Config> >::reset(LightGBM::Config*) (unique_ptr.h:456)
==2055==    by 0x151A3644: LightGBM::GBDT::ResetConfig(LightGBM::Config const*) (gbdt.cpp:753)
==2055==    by 0x15457E9C: LightGBM::Booster::ResetConfig(char const*) (c_api.cpp:329)
==2055==    by 0x15449721: LGBM_BoosterResetParameter (c_api.cpp:1592)
==2055==    by 0x1546BF4F: LGBM_BoosterResetParameter_R (lightgbm_R.cpp:381)
==2055==    by 0x4941B4C: R_doDotCall (dotcode.c:604)
==2055==    by 0x494CCC6: do_dotcall (dotcode.c:1281)
==2055==    by 0x499FB01: bcEval (eval.c:7078)
==2055==    by 0x498B67F: Rf_eval (eval.c:727)

I'm marking this blocking for #3484 , because I think CRAN will reject the package if we don't fix this.

Part of the issue here is that the check in https://github.com/microsoft/LightGBM/blob/cf69591b68c68a78ea4064e6941b8270b8a00eef/.ci/test_r_package_valgrind.sh for whether the valgrind test passed / failed is not strict enough. It currently only checks for the number of bytes lost, but should also be looking for "invalid read" and "invalid write" as well. I can fix that part.

@guolinke
Copy link
Collaborator

guolinke commented Nov 4, 2020

interesting, this is an omp declaration.

#pragma omp parallel for schedule(static, 512) reduction(+:tmp_sum_gradients, tmp_sum_hessians) if (num_data_in_leaf_ >= 1024 && !config_->deterministic)

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this.

@github-actions github-actions bot removed the blocking label Aug 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants