question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StackOverflowError in findSimpleCycles

See original GitHub issue
 * JGraphT version:1.4.0
 * Java version (java -version)/platform:  OpenJDK Runtime Environment Corretto-8.252.09.2 (build 1.8.0_252-b09) for Windows 10 x64

Issue I am trying to list all cycles in a very large sparse graph. I tried JohnsonSimpleCycles.findSimpleCycles() but it quickly generates a java.lang.StackOverflowError. The stacktrace shows a lot of calls “at org.jgrapht.alg.cycle.JohnsonSimpleCycles.getSCCs(JohnsonSimpleCycles.java:207)” that corresponds to the recursive call “getSCCs(startIndex, successorIndex);” I tried:

  1. increasing the stack size with -Xss8g,
  2. decreasing the dimension of graph using Long for vertexes instead of String for vertexes
  3. changing the algorithm to SzwarcfiterLauerSimpleCycles and HawickJamesSimpleCycles, but the result is always the same.

Steps to reproduce (small coding example) I attach the source and the data files to reproduce the issue.

Expected behaviour No StackOverflowError graph.zip

Other information I think the only way to remove the problem is rewriting the getSCCs function in an iterative way instead of the actual recursive way.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

1reaction
jkinablecommented, Mar 13, 2021

@JZamboni I implemented a non-recursive version of Gabow’s algorithm. In case you need it urgently, my implementation can be found here: https://github.com/jkinable/jgrapht/blob/gabow/jgrapht-core/src/main/java/org/jgrapht/alg/connectivity/GabowStrongConnectivityInspector.java

Sadly, we broke the performance testing framework (see issue #1047 ) during the last release. Until we figure out how to mend the performance testing suite, I can’t compare the non-recursive implementation with the old recursive implementation. I’ll hold off a PR until I know how the new implementation compares against the old one.

0reactions
JZambonicommented, Mar 16, 2021

@jkinable Thanks for the quick reply and implementation! I have tested it with my graph and the issue is gone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do I get StackOverFlowError when trying to DFS this ...
There are two possible explanations: There is a loop and your loop detection code isn't working. The graph is too deep; i.e. your...
Read more >
jgrapht - Bountysource
findSimpleCycles () but it quickly generates a java.lang.StackOverflowError. The stacktrace shows a lot of calls "at org.jgrapht.alg.cycle.
Read more >
The StackOverflowError in Java - Baeldung
Learn how one of Java's most common errors - StackOverflowError - occurs, and how to resolve it.
Read more >
[#MNG-6737] StackOverflowError when version ranges are ...
Maven throws StackOverflowError when version ranges are unsolvable and the dependency graph contains a cycle. $ mvn install .
Read more >
StackOverflowException due to insufficient Java stack - IBM
I am seeing java.lang.StackOverflowError while running the application. Why am I getting this error and how can I prevent it?
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found