You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using KLU.jl in PowerNetworkMatrices.jl. We've run into a few instances where code inexplicably errors on Windows only. The situations where it's cropped up have been fairly complex, though:
An EXCEPTION_ACCESS_VIOLATION in the test_ac_transmission_security_constrained_models.jl test file in thesm/n-1_modf branch of PowerSimulations.jl, first test here. Even after removing all multi-threading stuff from PowerNetworkMatrices.jl, this still failed, again on windows alone. @SebastianManriqueM
A BoundsError in a code snippet here. Relevant issue. This came up about a year ago--it was memorably weird, so I pushed the code to a fork to preserve it. However, to get it to run again, I'd need to go track down the compatible versions of the dependencies.
Has anyone else run into similar issues? I'll keep my eye out for a minimal reproducible example.
We've eliminated the issue internally, by writing our own KLU wrapper. Each ccall is enclosed in a global shared ReentrantLock: empirically, that change fixes the problem. I did not figure out the details myself--that'd be @jd-lara . The comment here describes the problem and our solution.
Concurrency stress tests now pass in CI on Windows, with both shared and separate factorizations. They don't run the applications in the report or use SuiteSparse 7.8.3, so this doesn't prove the cause was one of these bugs.
These fixes aren't in a release yet, as the latest one is v0.6.0. Please try again on the next release, or on main until then. If it still fails, please reopen this with a repro on that version, ideally a minimal one, along with your Julia version.
For reference, d79cbd5 has the global lock approach from your wrapper, in case a repro shows that it's needed.
For reference, #42 has the global lock approach from your wrapper, in case a repro shows that it's needed.
We've made some diagnostic progress; we now only serialize the calls on windows. Details are in the _LIBKLU_LOCK docstring on the psy6 branch of PowerNetworkMatrices.jl. It might also be worth looking at the test/test_klu_threaded.jl file (link) on that branch.
Yes! We've switched to maintaining our own wrapper, though, so it's harder to justify fixing things over here...but I'll at least keep tabs on the status of each, so that bugfixes in one spot don't get missed in the other.
Can you try the latest master here to see if it works fine on Windows.
Oh sadly I don't have ready access to a windows machine. I opened this issue in response to stuff other members of the Sienna dev team were running into--I'm just the person on that team who overlaps most with the JuliaSparse org
Marking this as closed (instead of not planned), since I think one of the recent fixes should cover this. If anyone runs into issues, please file a new issue with a reproducer.
Activity
luke-kiernan commentedon Sep 11, 2026
We've eliminated the issue internally, by writing our own KLU wrapper. Each
ccallis enclosed in a global sharedReentrantLock: empirically, that change fixes the problem. I did not figure out the details myself--that'd be @jd-lara . The comment here describes the problem and our solution.Serialize all libklu calls with a global lock
Serialize all libklu calls with a global lock
Serialize all libklu calls with a global lock
Serialize all libklu calls with a global lock
ViralBShah commentedon Oct 30, 2026
We haven't been able to reproduce this, so I'm closing it for now.
Since this was reported,
mainhas fixed several bugs that can cause failures like these:deepcopyshared the libklu objects with its source, givingKLU_INVALIDor crashes once the source was freedConcurrency stress tests now pass in CI on Windows, with both shared and separate factorizations. They don't run the applications in the report or use SuiteSparse 7.8.3, so this doesn't prove the cause was one of these bugs.
These fixes aren't in a release yet, as the latest one is v0.6.0. Please try again on the next release, or on
mainuntil then. If it still fails, please reopen this with a repro on that version, ideally a minimal one, along with your Julia version.For reference, d79cbd5 has the global lock approach from your wrapper, in case a repro shows that it's needed.
luke-kiernan commentedon Oct 30, 2026
We've made some diagnostic progress; we now only serialize the calls on windows. Details are in the _LIBKLU_LOCK docstring on the
psy6branch of PowerNetworkMatrices.jl. It might also be worth looking at thetest/test_klu_threaded.jlfile (link) on that branch.ViralBShah commentedon Oct 31, 2026
@luke-kiernan Do you have commit access here? Happy to add you.
Can you try the latest master here to see if it works fine on Windows. Lots of little things were found by the agent and fixed.
Test concurrent use of separate factorizations, and correct the threa…
Test concurrent use of separate factorizations, and correct the threa…
Test concurrent use of separate factorizations, and correct the threa…
Correct the thread-safety docs and stress test separate factorizations (
luke-kiernan commentedon Nov 2, 2026
Yes! We've switched to maintaining our own wrapper, though, so it's harder to justify fixing things over here...but I'll at least keep tabs on the status of each, so that bugfixes in one spot don't get missed in the other.
Oh sadly I don't have ready access to a windows machine. I opened this issue in response to stuff other members of the Sienna dev team were running into--I'm just the person on that team who overlaps most with the JuliaSparse org
ViralBShah commentedon Nov 2, 2026
Marking this as closed (instead of not planned), since I think one of the recent fixes should cover this. If anyone runs into issues, please file a new issue with a reproducer.