-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
JVM crashes with EXCEPTION_ACCESS_VIOLATION #2091
Comments
First we should test using the C++ sample, i'm pretty sure the leak comes from the SWIG wrapper... |
Coud you try to call the garbage collector between each iteration ?
note/ AFAIK this test always fails (90%) on windows CI... |
If the garbage collector is called after each solution is computed, the JVM does not crash (or, at least, it doesn't crash right after a few seconds). That's what I do now as workaround. For the example above: public static void main(String[] args) throws Exception {
while (true) { _main(args); System.gc(); }
} By invoking the garbage collector after a couple of solutions are computed, the JVM takes longer to crash, but it crashes eventually. public static void main(String[] args) throws Exception {
int i = 0;
while (true) { _main(args); if (++i % 8 == 0) System.gc(); }
} |
Another workaround, which is faster, reliable, and works as long as you have enough memory, is storing the reference to all RoutingModel instances created in a static (global) variable: private static final List<RoutingModel> workaround = new ArrayList<>();
public static void _main(String[] args) throws Exception {
…
RoutingModel routing = new RoutingModel(manager);
workaround.add(routing);
…
} That is, preventing RoutingModel from bein garbage collected also prevents the JVM from crashing. |
I'm having the same issue. Any updates on this? JVM crash log here: https://pastebin.com/1VJCsa1F EDIT: I also tested on Debian and Alpine and the problem persists. |
No, sooner or later the JVM crashes, no matter which workaround is used. |
IIRC java swig wrapper may use globals to store reference to callback, need to check if it can cause a leak or a double free error causing the JVM to crash, I'll try to investigate it... note: Usually we only instantiate one routing model, solve it, send/display/save result then close the program, i.e. we spawn one program per instance to solve -> need to add some tests and debug how well a server/daemon in Java is stable. |
Should be fixed on master see: |
It still crashes, i try to run the first example of CP_SAT (https://developers.google.com/optimization/cp/cp_example) and it still crashed.
|
I see a similar error running the same CP_SAT example file. I get as far as
Then |
What version of OR-tools and what language are you using?
Version: or-tools_VisualStudio2019-64bit_v7.6.7691
Language: Java
Which solver are you using
Routing Solver
What operating system and version?
Microsoft Windows [Version 10.0.16299.1932]
What did you do?
I put the method main of the example TspCities.java in an infinite loop; that is, in that example, I changed
public static void main(String[] args) throws Exception { … }
to
public static void _main(String[] args) throws Exception { … }
and added
public static void main(String[] args) throws Exception { while(true) _main(args); }
What did you expect to see
I expected to see no crash in the JVM
What did you see instead?
The JVM crashed after a few seconds with
The text was updated successfully, but these errors were encountered: