Skip to content

Fix infinite loop in FruchtermanReingoldLayout.#8217

Merged
ebarboni merged 1 commit intoapache:deliveryfrom
neilcsmith-net:gh8209
Feb 4, 2025
Merged

Fix infinite loop in FruchtermanReingoldLayout.#8217
ebarboni merged 1 commit intoapache:deliveryfrom
neilcsmith-net:gh8209

Conversation

@neilcsmith-net
Copy link
Copy Markdown
Member

Quick fix for #8209 - an infinite loop with large dependency tree because isThereFreeSpaceNonFixedSpace() never returns true.

Only loop ~3 rotations. Increased force constant seems to improve result with reduced search.

Fixes GH8209 - infinite loop because isThereFreeSpaceNonFixedSpace
always returns false.

Only loop ~3 rotations.
Increase force constant to improve result with reduced search.
@neilcsmith-net neilcsmith-net added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Jan 31, 2025
@neilcsmith-net neilcsmith-net requested a review from mbien January 31, 2025 17:34
@neilcsmith-net neilcsmith-net added this to the NB25 milestone Jan 31, 2025
@mbien mbien linked an issue Feb 1, 2025 that may be closed by this pull request
@mbien
Copy link
Copy Markdown
Member

mbien commented Feb 2, 2025

@neilcsmith-net those issues can be likely closed with this PR
https://issues.apache.org/jira/browse/NETBEANS-1146
https://issues.apache.org/jira/browse/NETBEANS-2414
https://issues.apache.org/jira/browse/NETBEANS-3283
https://issues.apache.org/jira/browse/NETBEANS-4314
https://issues.apache.org/jira/browse/NETBEANS-5770

although the complete fix would also include to not do this on EDT - but this goes beyond a hotix

@neilcsmith-net
Copy link
Copy Markdown
Member Author

although the complete fix would also include to not do this on EDT

That's unfortunately akin to trying to run a Swing layout off of the EDT. Might be OK to wrap in something like https://bits.netbeans.org/24/javadoc/org-netbeans-api-progress/org/netbeans/api/progress/BaseProgressUtils.html#runOffEventDispatchThread-java.lang.Runnable-java.lang.String-java.util.concurrent.atomic.AtomicBoolean-boolean-int-int-

@mbien
Copy link
Copy Markdown
Member

mbien commented Feb 3, 2025

That's unfortunately akin to trying to run a Swing layout off of the EDT.

yeah this shouldn't be done, the hope is that something in the computation can be detached from swing but I haven't looked into it so far. To get an idea I would:

  • generate an async profiler flame graph to see the code paths which spend most of the CPU time during init (I still haven't progressed with my nb plugin which would make this easier)
  • now check if the geometric data can be copied, computed asynchronously and then copied back into the swing data structure on EDT

if nothing helps or would make things too complicated I would:

  • try to predict graph complexity by counting nodes, if there are too many nodes warn the user that the computation can take a while
  • pause the computation every 15s and ask cancel/continue?

@ebarboni ebarboni merged commit c5503f0 into apache:delivery Feb 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) Maven [ci] enable "build tools" tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generating pom graph locks Apache Netbeans

3 participants