Skip to content

Destroy the views of the dynamic statistics and keep their base view - #3371

Merged
mbastian merged 2 commits into
masterfrom
fix/statistics-dynamic-views
Oct 29, 2026
Merged

mbastian merged 2 commits into
masterfrom
fix/statistics-dynamic-views

Conversation

@mbastian

Copy link
Copy Markdown
Member

Description

Follow-up to the view lifetime work (gephi/graphstore#364, #3366, #3368, #3369). The dynamic statistics created a view for every time window and never destroyed it, and read the view to work on once, outside any lock.

  • A view was created for each window of StatisticsControllerImpl.executeDynamic and never destroyed, on any path, so a run left hundreds or thousands of live views behind (each one is updated on every change of the graph store, and GraphStore serializes views, so they were also written to saved projects).
  • The visible view was read once, outside any lock, and its time index was requested for every window. When a filter destroyed that view during the run, the next window threw The view doesn't exist. The windows without time bounds read the current visible graph instead of that view, so after a filter change the two kinds of window were computed on different views.
  • The task used the graph model of the current workspace instead of the one of the workspace of its model, as executeStatic does, so the run and its report could end up on different workspaces if the current workspace changed between the call and the start of the task.

The visible view is now copied under the write lock into a private base view for the whole run (the main view is used as is). A single window view is created once, cleared and refilled for each window, and both views are destroyed in a finally, after the read locks are released. A cancelled run still produces no report. The loop javadoc of DynamicStatistics says the window is only valid during the call, as it is now reused.

Left out on purpose: the dynamic statistics write their series with getGraphVisible().setAttribute(...), so when a filter replaces the visible view during the run they end up on different views.

Checklist

  • Merged with master beforehand

Added tests?

  • 👍 yes: StatisticsControllerImplTest, which destroys the filtered view during the first window and checks the next windows still read the filtered graph and that the window view is destroyed at the end
  • 🙅 no, because they aren't needed

Added to documentation?

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

🤖 Generated with Claude Code

A dynamic statistic created a view for every time window and never destroyed
any, so each run left hundreds of live views that every later graph change had
to update. It also read the visible view once and looked up its time index at
each window: a filter destroying that view during the run made the next window
throw, and the windows without time bounds read whatever was visible at the
time. A filtered visible view is now copied under the write lock and read from
that copy, a single window view is refilled for each window, and both are
destroyed when the run ends, is cancelled or fails. The loop() javadoc now says
the window view is only valid during the call. The graph model is also taken
from the statistics model's workspace, as for static statistics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mbastian
mbastian requested a review from a team as a code owner October 29, 2026 19:12
@mbastian mbastian added this to the 0.11.4 milestone Oct 29, 2026
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mbastian
mbastian merged commit 8b5b307 into master Oct 29, 2026
3 checks passed
@mbastian
mbastian deleted the fix/statistics-dynamic-views branch November 17, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant