Repository navigation
Keep following the store with the graphs of destroyed views that are still held - #364
Merged
Merged
Conversation
…still held A destroyed view was no longer updated by the store, so a graph of it that was still held, for instance fetched just before a filter replaced and destroyed the visible view, went stale. Its counts and bit vectors no longer matched the store, store ids are reused, and `getEdges().toArray()` threw `IllegalStateException: End size ... is less than fixed size ...`. The most recently destroyed views (up to 8) are now tracked through weak references and updated by the same hooks as the live views, so a graph held after the destroy behaves like the graph of a live view. The older ones are emptied, which keeps them consistent, and unreferenced ones are dropped by the garbage collector. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
3 of 8 tasks
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A destroyed view is removed from
GraphViewStore.views, so the store no longer updates it. A graph of it that is still held keeps stale counts and bit vectors, and store ids are reused, so it can even contain elements it never had.This happens in Gephi's layouts: they fetch
getGraphVisible()and only then take its read lock. In that window a filter can replace the visible view and destroy the old one. If edges are then removed from the store,getEdges().toArray()on the held graph throwsIllegalStateException: End size ... is less than fixed size ...and kills the layout thread. It was found by the release-test soak with ForceAtlas 2.Fix
GraphViewStoretracks the most recently destroyed views (up toMAX_DESTROYED_VIEWS= 8) through weak references, and the hooks that update the views (addNode,removeNode,addEdge,removeEdge,setEdgeType,clear,clearEdges) update them too. A graph held after the destroy therefore behaves like the graph of a live view, and unreferenced destroyed views are dropped by the garbage collector. A view that falls out of the 8 most recent is emptied, so it stays consistent instead of going stale.Not changed: a destroyed view is still gone for everything addressed by view (observers, indexes,
setVisibleView, ...), these keep throwingThe view doesn't exist. The view indexes are deleted on destroy and are not recreated.Emptying the view on destroy was tried first and dropped, as callers rely on a destroyed view keeping its content (e.g. a filter swap alone doesn't change the store, so the previous result is still valid).
Cost
Each tracked destroyed view costs about the same as a live view on every change of the store, so the cap (8) is the worst case, however many views are held. Without destroyed views there is no measurable change. With 8 tracked node-only views (10k nodes, 100k edges), adding the edges takes about 61-67 ms instead of 43 ms and removing them about 36-41 ms instead of 21 ms; node+edge views cost much less (about 44 and 23 ms).
Tests
GraphViewStoreTestcompares destroyed views with live control views created the same way (node and edge, node-only and edge-only views) after removals, store id reuse, edge type changes,clearandclearEdges, with attribute and time indexes, and checks the cap and that unreferenced views are released. Without the fix 9 of the 10 new tests fail, one of them with the original exception (the tenth guards against emptying the view on destroy).🤖 Generated with Claude Code