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
Add travis sanitizers tests. #3557
Conversation
385cf5a
to
82c8fcc
Compare
Codecov Report
@@ Coverage Diff @@
## master #3557 +/- ##
============================================
+ Coverage 50.03% 50.06% +0.03%
Complexity 188 188
============================================
Files 172 172
Lines 13887 13924 +37
Branches 457 457
============================================
+ Hits 6948 6971 +23
- Misses 6714 6728 +14
Partials 225 225
Continue to review full report at Codecov.
|
Seems asan-0.0 comes with GCC 4.8 is not doing its job well. |
82c8fcc
to
6c29d00
Compare
6c29d00
to
6a30bad
Compare
@hcho3 @RAMitchell Just tested asan on my machine with gcc-4.9 with Guix (where has no CUDA), which has libasan-1.0. In short, it doesn't work. To confirm the testxgboost did linked against libasan, do: ASAN_OPTIONS=verbosity=1 ./testxgboost I saw outputs like:
But no error is generated. So I think the problem is indeed on asan. I attached the complete log for running ./testxgboost built by gcc-7, generated from: export ASAN_SYMBOLIZER_PATH=$(which llvm-symbolizer)
ASAN_OPTIONS=symbolize=1 ./testxgboost > log 2>&1 You can check the errors, see if it's worthy to upgrade Travis. |
I think we should definitely add it to continuous integration. Some of these errors may be quite significant. This thread has some possibilities for installing different packages on Travis for different parts of the build matrix: travis-ci/travis-ci#3505 Could we install gcc7 in this way? |
6a30bad
to
ce75a4c
Compare
@trivialfis Thanks a lot for introducing me to sanitizers. I used address sanitizer to locate a double-free error in MXNet. This is super cool! |
@hcho3 Nah. Idea of putting it in XGBoost came from @RAMitchell while I did the leg work. I guess he had enough with these bugs in XGBoost. |
ce75a4c
to
4ac0ffe
Compare
Voilà. asan on Travis sorted out. Other than asan, the thread sanitizer reveals loads of data races, many of them relate to openmp. Some of them might be false positive since tsan still on beta, but seem pretty scary. Running thread sanitizer would take much longer than running address sanitizer (so long that I never cross the c_api.XGDMatrixCreateFromMat_omp test), and requires a lot more memory too. So it might not be a good fit for Travis. @hcho3 , @RAMitchell WDYT? |
Very nice! Some of the data races may actually be intentional - for example the shotgun linear models solver uses hog wild parallelism. Can you post the log for tsan? Let's try to fix some of these leaks in this PR. It might also be interesting to run the python tests, although they are probably too time consuming to run on Travis. |
@RAMitchell The attached tsan log is generated without CUDA. The time from shell says that it takes about 45 minutes to get it so you might want a better computer to deal with it. That make sense, shotgun did contribute about half of the warning. |
src/c_api/c_api.cc
Outdated
@@ -442,14 +442,14 @@ void PrefixSum(size_t *x, size_t N) { | |||
delete[] suma; | |||
} | |||
|
|||
XGB_DLL int XGDMatrixCreateFromMat_omp(const bst_float* data, // NOLINT | |||
XGB_DLL int XGDMatrixCreateFromMat_omp(const bst_float* _data, // NOLINT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we renaming data
to _data
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first time I read the code got a little bit confused by namespace data, param data and mat.page_.data. I will try to fix all leaks from tests in this PR and change these thing back after done.
7adffe0
to
379f402
Compare
If everything looks fine then I will rebase it into two commits, one concerning Travis and another concerning fixes. |
379f402
to
0906544
Compare
* Add gcc-7 in Travis. * Add SANITIZER_PATH for CMake. * Enable sanitizer tests in Travis.
* Fix all memory leaks reported by Address Sanitizer. * tests/cpp/helpers.h/CreateDMatrix now returns raw pointer.
0906544
to
a62491a
Compare
Ready now. |
Early PR. I need to see how's travis reacting.