Skip to content

Fix graph read-lock leaks in layout plugins and PartitionColorTransformerPanel - #3298

Merged
mbastian merged 1 commit into
masterfrom
fix/readlock-leak-layouts
Sep 5, 2026
Merged

mbastian merged 1 commit into
masterfrom
fix/readlock-leak-layouts

Conversation

@mbastian

@mbastian mbastian commented Sep 5, 2026

Copy link
Copy Markdown
Member

Description

Follow-up to #3297 (which fixed the same bug class in GraphSelectionImpl/GraphIndexImpl). A full-repo audit of graph.readLock() call sites found 4 more places where the read lock could leak or be released without ever being held:

  • ForceAtlas2.goAlgo(), ForceAtlasLayout.goAlgo(), OpenOrdLayout.initAlgo(): two statements ran between readLock() and the try block. If either threw, the lock leaked permanently. Fixed by moving them inside try.
  • PartitionColorTransformerPanel.setup(): readLock() was the first statement inside try, with an unconditional readUnlock() in finally. If readLock() itself threw, finally would call readUnlock() on a lock never acquired (unbalanced unlock, throws IllegalMonitorStateException). Fixed by moving readLock() to right before try.

All four now follow the established convention:

graph.readLock();
try {
    ...
} finally {
    graph.readUnlock(); // or readUnlockAll()
}

Checklist

  • Merged with master beforehand

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed

These are lock-acquisition ordering fixes with no behavioral change on the happy path; the affected failure path only occurs when an internal lookup throws, which isn't practical to trigger from existing test scaffolding.

Added to documentation?

  • 👍 README.md
  • 👍 API Changes
  • 👍 Additional documentation in docs
  • 👍 Relevant code documentation
  • 🙅 no, because they aren't needed

…yout, PartitionColorTransformerPanel

In FA2/ForceAtlasLayout/OpenOrdLayout, statements ran between readLock()
and the try block, leaking the lock on exception. In
PartitionColorTransformerPanel, readLock() was inside the try with an
unconditional readUnlock() in finally, causing an unbalanced unlock if
readLock() itself threw.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mbastian mbastian added this to the 0.11.3 milestone Sep 5, 2026
@mbastian mbastian added the Sustainability Core improvements to improve reliability or maintenance label Sep 5, 2026
@mbastian
mbastian merged commit d952c85 into master Sep 5, 2026
3 checks passed
@mbastian
mbastian deleted the fix/readlock-leak-layouts branch September 5, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Sustainability Core improvements to improve reliability or maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant