# Issue with XGBoost.jl and LIBSVM.jl when Julia 1.8.4

**URL:** <https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396>\
**Category:** General Usage\
**Tags:** packages\
**Created:** [January 1, 2023, 9:43pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396 "2023-01-01T21:43:35Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![matnbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matnbo/32/220166_2.png) [@matnbo](https://discourse.julialang.org/u/matnbo)\
**Post date:** [January 1, 2023, 9:43pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/1 "2023-01-01T21:43:35Z")

</div>

Dear all  
I am using XGBoost.jl v2.2.0 and LIBSVM.jl v0.8.0, under Windows 11.  
It works fine with Julia 1.8.3

```julia
versioninfo()
Julia Version 1.8.3
Commit 0434deb161 (2022-11-14 20:14 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 8 on 16 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 8

```

But when I uses Julia 1.8.4

```julia
julia> versioninfo()
Julia Version 1.8.4
Commit 00177ebc4f (2022-12-23 21:32 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 8 on 16 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS = 8

```

both packages kills my Julia session, for instance after doing:

```julia
using XGBoost
(X, y) = (randn(100,4), randn(100))

```

doing

```julia
xgboost((X, y))

```

kills the process and closes directly Julia. Same when I run any function of LIBSVM.jl.

Did somebody observe the same problem and know what is happening?

---

<div class="post-metadata">

**Author:** ![ablaom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ablaom/32/4889_2.png) [@ablaom](https://discourse.julialang.org/u/ablaom)\
**Post date:** [January 9, 2023, 2:11am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/2 "2023-01-09T02:11:20Z")

</div>

For what it’s worth I cannot reproduce on my mac

```julia
julia> versioninfo()
Julia Version 1.8.4
Commit 00177ebc4fc (2022-12-23 21:32 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin21.4.0)
  CPU: 12 × Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, skylake)
  Threads: 5 on 12 virtual cores
Environment:
  JULIA_LTS_PATH = /Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
  JULIA_PATH = /Applications/Julia-1.8.app/Contents/Resources/julia/bin/julia
  JULIA_EGLOT_PATH = /Applications/Julia-1.6.app/Contents/Resources/julia/bin/julia
  JULIA_NUM_THREADS = 5
  DYLD_LIBRARY_PATH = /usr/local/homebrew/Cellar/libomp/9.0.1/lib/
  JULIA_NIGHTLY_PATH = /Applications/Julia-1.8.app/Contents/Resources/julia/bin/julia

```

Given that you are having trouble with both these packages, I think you would be entitled to raise an issue directly at [GitHub - JuliaLang/julia: The Julia Programming Language](https://github.com/JuliaLang/julia) and see if you can get help there. Worth mentioning that both the packages wrap C/C++ code.

---

<div class="post-metadata">

**Author:** ![matnbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matnbo/32/220166_2.png) [@matnbo](https://discourse.julialang.org/u/matnbo)\
**Post date:** [January 9, 2023, 9:23am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/3 "2023-01-09T09:23:29Z")

</div>

Ok thanks I will do.

I already opened two issues: [https://github.com/JuliaML/LIBSVM.jl/issues/95](https://github.com/JuliaML/LIBSVM.jl/issues/95) and [https://github.com/dmlc/XGBoost.jl/issues/153](https://github.com/dmlc/XGBoost.jl/issues/153). The second raised unexplained error on windows.

---

<div class="post-metadata">

**Author:** ![skleinbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skleinbo/32/36080_2.png) [@skleinbo](https://discourse.julialang.org/u/skleinbo)\
**Post date:** [January 9, 2023, 3:04pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/4 "2023-01-09T15:04:13Z")

</div>

Julia 1.8.5 should be released any minute now.  
Given that it works on 1.8.3, I would wait for the new release and see if that fixes it, and revert to 1.8.3 in the meantime.

---

<div class="post-metadata">

**Author:** ![tylerjthomas9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tylerjthomas9/32/44878_2.png) [@tylerjthomas9](https://discourse.julialang.org/u/tylerjthomas9)\
**Post date:** [January 9, 2023, 6:57pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/5 "2023-01-09T18:57:06Z")

</div>

Something in 1.8.4, 1.9 betas, and the current nightly build is causing a heap corruption (`exit code: 3221226356`) on Windows when using ccall. I have not been able to pinpoint the change that is causing this issue. I hope that 1.8.5 fixes it.

Here is a short code snippet to reproduce the error:

```julia
using XGBoost
x = rand(4,5)

o = Ref{XGBoost.DMatrixHandle}()
sz = reverse(size(x))
xp = convert(Matrix{Cfloat}, x)
missing_value=NaN32
XGBoost.xgbcall(XGBoost.XGDMatrixCreateFromMat, xp, sz[1], sz[2], missing_value, o)

```

Here is the function that is being called in XGBoost.jl:

```julia
function XGDMatrixCreateFromMat(data, nrow, ncol, missing, out)
    @ccall libxgboost.XGDMatrixCreateFromMat(data::Ptr{Cfloat}, nrow::bst_ulong, ncol::bst_ulong, missing::Cfloat, out::Ptr{DMatrixHandle})::Cint
end

```

---

<div class="post-metadata">

**Author:** ![tylerjthomas9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tylerjthomas9/32/44878_2.png) [@tylerjthomas9](https://discourse.julialang.org/u/tylerjthomas9)\
**Post date:** [January 10, 2023, 1:51am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/6 "2023-01-10T01:51:50Z")

</div>

I am still seeing the error in `v1.8.5`. I am not sure what could be causing it. Here is the `v1.8.3` to `v1.8.4` changelog: [Comparing v1.8.3...v1.8.4 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/compare/v1.8.3...v1.8.4)

My best guess is that it was one of these PRs:  
[[CompilerSupportLibraries\_jll] Upgrade to libraries from GCC 12 by tylerjthomas9 · Pull Request #47544 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/47544) (Upgrade to libraries from GCC 12)  
[https://github.com/JuliaLang/julia/pull/46976](https://github.com/JuliaLang/julia/pull/46976) (Probe and dlopen() the correct libstdc++)

---

<div class="post-metadata">

**Author:** ![matnbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matnbo/32/220166_2.png) [@matnbo](https://discourse.julialang.org/u/matnbo)\
**Post date:** [January 10, 2023, 3:10pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/7 "2023-01-10T15:10:35Z")

</div>

> [@tylerjthomas9](#):
>
> I am still seeing the error in `v1.8.5`. I am not sure what could be causing it

yes I just tried 1.8.5, and also observed the same problem: Julia crashes. And as you said @tylerjthomas9, it seems the problem persists in 1.9 betas.

Until now, I stayed to 1.8.3 for daily uses, to be able to use XGBoost and LIBSVM, and got no solutions from [https://github.com/JuliaLang/julia/issues/48187](https://github.com/JuliaLang/julia/issues/48187). I assume that there are many users of XGBoost.jl and LIBSVM.jl under Windows; I don’t know if some have found another strategy.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [January 10, 2023, 3:39pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/8 "2023-01-10T15:39:28Z")

</div>

Can you compile Julia on Windows? In that case you bisect ([Git - git-bisect Documentation](https://git-scm.com/docs/git-bisect)) and find what change that caused the issue.

---

<div class="post-metadata">

**Author:** ![tylerjthomas9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tylerjthomas9/32/44878_2.png) [@tylerjthomas9](https://discourse.julialang.org/u/tylerjthomas9)\
**Post date:** [January 11, 2023, 7:47am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/10 "2023-01-11T07:47:00Z")

</div>

> [@kristoffer.carlsson](#):
>
> Can you compile Julia on Windows? In that case you bisect ([Git - git-bisect Documentation](https://git-scm.com/docs/git-bisect)) and find what change that caused the issue.

The error first occurs with this commit: [[CompilerSupportLibraries\_jll] Upgrade to libraries from GCC 12 (#47544) · JuliaLang/julia@c8b72e2 · GitHub](https://github.com/JuliaLang/julia/commit/c8b72e2bf49046e8daca64214765694377277947)

---

<div class="post-metadata">

**Author:** ![tylerjthomas9](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tylerjthomas9/32/44878_2.png) [@tylerjthomas9](https://discourse.julialang.org/u/tylerjthomas9)\
**Post date:** [January 19, 2023, 4:24pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/11 "2023-01-19T16:24:41Z")

</div>

I am still seeing this issue on `v1.9.0-beta3` and the current nightly build (`v1.10.0-DEV.398 (2023-01-19)`.

---

<div class="post-metadata">

**Author:** ![matnbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matnbo/32/220166_2.png) [@matnbo](https://discourse.julialang.org/u/matnbo)\
**Post date:** [January 19, 2023, 5:21pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/12 "2023-01-19T17:21:58Z")

</div>

Same for me, I still observed the issue on `v1.9.0-beta3`

---

<div class="post-metadata">

**Author:** ![matnbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matnbo/32/220166_2.png) [@matnbo](https://discourse.julialang.org/u/matnbo)\
**Post date:** [February 10, 2023, 11:02pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/13 "2023-02-10T23:02:20Z")

</div>

Same for [v1.9.0-beta4](https://discourse.julialang.org/t/julia-v1-9-0-beta4-is-now-available/94421)

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [February 11, 2023, 12:09am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/14 "2023-02-11T00:09:46Z")

</div>

Bugs don’t usually get fixed alone unless someone understands what the issue really is (we know only the symptoms) and finds an appropriate solution.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [March 15, 2023, 2:18am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/15 "2023-03-15T02:18:39Z")

</div>

I’m a bit confused on what is going on here.

The issue appears to have been bisected to [[CompilerSupportLibraries\_jll] Upgrade to libraries from GCC 12 by tylerjthomas9 · Pull Request #47544 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/47544) by [tylerjthomas9](https://discourse.julialang.org/u/tylerjthomas9) [above](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/10).

Tyler appears to bisected the 1.8 branch. Did anyone try reverting the corresponding commit on the 1.8 branch to see if this resolves the issue?

The corresponding changes on the `master` branch are

- [[CompilerSupportLibraries\_jll] Upgrade to libraries from GCC 12 by giordano · Pull Request #45582 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/45582)
- [[CompilerSupportLibraries\_jll] Update to new build by giordano · Pull Request #47444 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/47444)

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [March 16, 2023, 11:14pm UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/16 "2023-03-16T23:14:03Z")

</div>

Running `julia` under `gdb` from MSYS2, I ran the following Julia code:

```julia
using XGBoost

# training set of 100 datapoints of 4 features
(X, y) = (randn(100,4), randn(100))

# create and train a gradient boosted tree model of 5 trees
bst = xgboost((X, y), num_round=5, max_depth=6, objective="reg:squarederror")

```

I then got the following trace.

```julia
warning: Critical error detected c0000374

Thread 1 received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffbbf64f633 in ntdll!RtlIsZeroMemory () from C:\windows\SYSTEM32\ntdll.dl
(gdb) bt
#0 0x00007ffbbf64f633 in ntdll!RtlIsZeroMemory () from C:\windows\SYSTEM32\ntdll.dll
#1 0x00007ffbbf6583f2 in ntdll!RtlpNtSetValueKey () from C:\windows\SYSTEM32\ntdll.dll
#2 0x00007ffbbf6586da in ntdll!RtlpNtSetValueKey () from C:\windows\SYSTEM32\ntdll.dll
#3 0x00007ffbbf65e361 in ntdll!RtlpNtSetValueKey () from C:\windows\SYSTEM32\ntdll.dll
#4 0x00007ffbbf575bf0 in ntdll!RtlGetCurrentServiceSessionId ()
   from C:\windows\SYSTEM32\ntdll.dll
#5 0x00007ffbbf5747b1 in ntdll!RtlFreeHeap () from C:\windows\SYSTEM32\ntdll.dll
#6 0x00007ffbbd5b9c9c in msvcrt!free () from C:\windows\System32\msvcrt.dll
#7 0x0000000002d6a0ef in unsigned long long xgboost::SparsePage::Push<xgboost::data::DenseAdapterBatch>(xgboost::data::DenseAdapterBatch const&, float, int) ()
   from C:\Users\mkitti\.julia\artifacts\a1540ff6121e48fd4712006a269d6bf6bf8216e1\bin\xgboost.dll
#8 0x0000000002dbac97 in xgboost::data::SimpleDMatrix::SimpleDMatrix<xgboost::data::DenseAdapter>(xgboost::data::DenseAdapter*, float, int) ()
   from C:\Users\mkitti\.julia\artifacts\a1540ff6121e48fd4712006a269d6bf6bf8216e1\bin\xgboost.dll
#9 0x0000000002e70883 in xgboost::DMatrix* xgboost::DMatrix::Create<xgboost::data::DenseAdapter>(xgboost::data::DenseAdapter*, float, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from C:\Users\mkitti\.julia\artifacts\a1540ff6121e48fd4712006a269d6bf6bf8216e1\bin\xgboost.dll
#10 0x0000000002b555fb in XGDMatrixCreateFromMat ()
   from C:\Users\mkitti\.julia\artifacts\a1540ff6121e48fd4712006a269d6bf6bf8216e1\bin\xgboost.dll
#11 0x000002248136cd09 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

```

```julia
(gdb) b unsigned long long xgboost::SparsePage::Push<xgboost::data::DenseAdapterBatch>(xgboost::data::DenseAdapterBatch const&, float, int)

(gdb) s
Single stepping until exit from function _ZN7xgboost10SparsePage4PushINS_4data17DenseAdapterBatchEEEyRKT_fi,
which has no line number information.
operator new (sz=8) at /workspace/srcdir/gcc-12.1.0/libstdc++-v3/libsupc++/new_op.cc:47
47 /workspace/srcdir/gcc-12.1.0/libstdc++-v3/libsupc++/new_op.cc: No such file or directory.
(gdb) s
50 in /workspace/srcdir/gcc-12.1.0/libstdc++-v3/libsupc++/new_op.cc
(gdb) s
58 in /workspace/srcdir/gcc-12.1.0/libstdc++-v3/libsupc++/new_op.cc

(gdb) s
0x00000000029a9f9d in unsigned long long xgboost::SparsePage::Push<xgboost::data::DenseAdapterBatch>(xgboost::data::DenseAdapterBatch const&, float, int) () from C:\Users\kittisopikulm\.julia\artifacts\a1540ff6121e48fd4712006a269d6bf6bf8216e1\bin\xgboost.dll

(gdb) s
Single stepping until exit from function _ZN7xgboost10SparsePage4PushINS_4data17DenseAdapterBatchEEEyRKT_fi,
which has no line number information.
operator delete (ptr=0x18d2233a620) at /workspace/srcdir/gcc-12.1.0/libstdc++-v3/libsupc++/del_op.cc:49
49 /workspace/srcdir/gcc-12.1.0/libstdc++-v3/libsupc++/del_op.cc: No such file or directory.
(gdb) s
0x00007ffb58ae68e0 in free () from C:\Users\mkitti\.julia\juliaup\julia-1.8.5+0.x64.w64.mingw32\bin\libstdc++-6.dll

(gdb) s
Single stepping until exit from function free,
which has no line number information.
0x00007ffbbd5b9c80 in msvcrt!free () from C:\windows\System32\msvcrt.dll

```

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [March 17, 2023, 12:55am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/17 "2023-03-17T00:55:16Z")

</div>

Looks like the issue is somewhere around here:

> <https://github.com/dmlc/xgboost/blob/36ad160501251336bfe69b602acc37ab3ec32d69/src/data/data.cc#LL1074>

```julia
0x00007ffbbf64f633 in ntdll!RtlIsZeroMemory () from C:\windows\SYSTEM32\ntdll.dll
(gdb) bt
#0 0x00007ffbbf64f633 in ntdll!RtlIsZeroMemory () from C:\windows\SYSTEM32\ntdll.dll
#1 0x00007ffbbf6583f2 in ntdll!RtlpNtSetValueKey () from C:\windows\SYSTEM32\ntdll.dll
#2 0x00007ffbbf6586da in ntdll!RtlpNtSetValueKey () from C:\windows\SYSTEM32\ntdll.dll
#3 0x00007ffbbf65e361 in ntdll!RtlpNtSetValueKey () from C:\windows\SYSTEM32\ntdll.dll
#4 0x00007ffbbf575bf0 in ntdll!RtlGetCurrentServiceSessionId ()
   from C:\windows\SYSTEM32\ntdll.dll
#5 0x00007ffbbf5747b1 in ntdll!RtlFreeHeap () from C:\windows\SYSTEM32\ntdll.dll
#6 0x00007ffbbd5b9c9c in msvcrt!free () from C:\windows\System32\msvcrt.dll
#7 0x000000000264d1f6 in xgboost::SparsePage::Push<xgboost::data::DenseAdapterBatch> (
    this=this@entry=0x20d9e121ee0, batch=..., missing=<optimized out>,
    missing@entry=nan(0x400000), nthread=<optimized out>)
    at /workspace/srcdir/xgboost/src/data/data.cc:1074
#8 0x000000000269de8a in xgboost::data::SimpleDMatrix::SimpleDMatrix<xgboost::data::DenseAdapter>
    (this=0x20d8a872100, adapter=0xb6a47fc460, missing=nan(0x400000), nthread=<optimized out>)
    at /workspace/srcdir/xgboost/src/data/simple_dmatrix.cc:144
#9 0x0000000002751633 in xgboost::DMatrix::Create<xgboost::data::DenseAdapter> (
    adapter=adapter@entry=0xb6a47fc460, missing=missing@entry=nan(0x400000),
    nthread=nthread@entry=1) at /workspace/srcdir/xgboost/src/data/data.cc:917
#10 0x0000000002454a9d in XGDMatrixCreateFromMat (data=<optimized out>, nrow=<optimized out>,
    ncol=<optimized out>, missing=nan(0x400000), out=0x20d909185d0)
    at /workspace/srcdir/xgboost/src/c_api/c_api.cc:457

```

I’ve debugged this to the degree that I know how.

I produced a version of XGBoost\_jll.jl with debugging symbols here:

> **[GitHub - mkitti/XGBoost\_jll.jl](https://github.com/mkitti/XGBoost_jll.jl)**
>
> Contribute to mkitti/XGBoost\_jll.jl development by creating an account on GitHub.

@staticfloat @giordano @gbaraldi if you can think of any other thing to look at, please let me know.

---

<div class="post-metadata">

**Author:** ![matnbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matnbo/32/220166_2.png) [@matnbo](https://discourse.julialang.org/u/matnbo)\
**Post date:** [March 17, 2023, 7:54am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/18 "2023-03-17T07:54:56Z")

</div>

> [@mkitti](#):
>
> I’ve debugged this to the degree that I know how.

Thanks @mkitti. For my understanding, does the problem comes finally from XGBoost.jl? Since it was suggested [here](https://github.com/JuliaML/LIBSVM.jl/issues/95) and [here](https://github.com/dmlc/XGBoost.jl/issues/153) that the problem was on the Julia side (and the problem is also observed for LIBSVM.jl).

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [March 18, 2023, 6:44am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/19 "2023-03-18T06:44:04Z")

</div>

> [@matnbo](#):
>
> Thanks @mkitti. For my understanding, does the problem comes finally from XGBoost.jl? Since it was suggested [here](https://github.com/JuliaML/LIBSVM.jl/issues/95) and [here](https://github.com/dmlc/XGBoost.jl/issues/153) that the problem was on the Julia side (and the problem is also observed for LIBSVM.jl).

Let me try to describe what I’m seeing above in plain English.

XGBoost is a C++ project that uses OpenMP for parallelization. When `XGDMatrixCreateFromMat` is invoked, the method `unsigned long long xgboost::SparsePage::Push<xgboost::data::DenseAdapterBatch>(xgboost::data::DenseAdapterBatch const&, float, int) ` is eventually called. This contains a potentially parallel for loop via OpenMP.

The creation of this parallel for loop is created by interacting with libstdc++ and libgomp. Julia provides both of these libraries as part of its CompilerSupportLibraries\_jll:

> **[GitHub - JuliaBinaryWrappers/CompilerSupportLibraries\_jll.jl](https://github.com/JuliaBinaryWrappers/CompilerSupportLibraries_jll.jl)**
>
> Contribute to JuliaBinaryWrappers/CompilerSupportLibraries\_jll.jl development by creating an account on GitHub.

Some update to this these libraries seems to causing XGBoost to free some memory that should not be freed. Recent updates bumped this the underlying gcc to version 12.

Another change is the disabling of thread local storage on Windows builds:

> <https://github.com/JuliaPackaging/Yggdrasil/commit/e5b264e5d9dc81565ea1cd033d4789d04aff9891>
>
> \* \[0\_RootFS\] Always disable TLS when building GCC for Windows
> 
> \* \[0\_RootFS\] Up…load also logs tarballs

The issue is thus not directly with Julia itself but rather with libraries that it provides.

---

<div class="post-metadata">

**Author:** ![matnbo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/matnbo/32/220166_2.png) [@matnbo](https://discourse.julialang.org/u/matnbo)\
**Post date:** [March 18, 2023, 8:21am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/20 "2023-03-18T08:21:52Z")

</div>

Thanks @mkiti

---

<div class="post-metadata">

**Author:** ![MilkshakeForReal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/milkshakeforreal/32/32861_2.png) [@MilkshakeForReal](https://discourse.julialang.org/u/MilkshakeForReal)\
**Post date:** [March 22, 2023, 2:35am UTC](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396/21 "2023-03-22T02:35:05Z")

</div>

@mkiti Thanks for your insights, do you see a possible fix?

[Next page](https://discourse.julialang.org/t/issue-with-xgboost-jl-and-libsvm-jl-when-julia-1-8-4/92396.md?page=2)
