Skip to content

Fix Bdv too frequent navigation deadlock#372

Merged
tinevez merged 1 commit into
mastodon-sc:devfrom
stefanhahmann:bdv-to-frequent-navigation-deadlock
Sep 8, 2025
Merged

Fix Bdv too frequent navigation deadlock#372
tinevez merged 1 commit into
mastodon-sc:devfrom
stefanhahmann:bdv-to-frequent-navigation-deadlock

Conversation

@stefanhahmann
Copy link
Copy Markdown
Collaborator

@stefanhahmann stefanhahmann commented Jul 11, 2025

This PR contains a strategy to avoid to frequent navigation requests to the Big Data Viewer, which cause Mastodon to get stuck in certain sitations.

It is not the actual bug fix (that probably needs to be done in Big Data Viewer), but a work around to avoid the Big Data Viewer to get into this bug.

Fixes #371

Improvements to navigation frequency control:

  • Added a lastNavigationTime field to track the timestamp of the last navigation request and prevent navigation requests that occur too frequently. This logic was implemented in both navigateToVertex and navigateToEdge methods. [1] [2] [3] [4]

@stefanhahmann stefanhahmann self-assigned this Jul 11, 2025
@stefanhahmann stefanhahmann changed the base branch from master to dev July 11, 2025 11:15
@stefanhahmann stefanhahmann requested a review from Copilot July 11, 2025 11:17
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

A workaround to prevent excessive navigation requests to the Big Data Viewer by enforcing a minimum delay between actions, reducing the chance of deadlock.

  • Introduces lastNavigationTime and a constant ANIMATION_DURATION to throttle rapid successive navigations.
  • Applies throttle checks in both navigateToVertex and navigateToEdge, and replaces hard-coded 300 ms durations with the new constant.
Comments suppressed due to low confidence (2)

src/main/java/org/mastodon/views/bdv/overlay/OverlayNavigation.java:129

  • After allowing a navigation in navigateToEdge, lastNavigationTime is never updated. Add lastNavigationTime = now; immediately after the throttle check to correctly record the timestamp for subsequent calls.
			panel.setTransformAnimator( animator );

src/main/java/org/mastodon/views/bdv/overlay/OverlayNavigation.java:51

  • [nitpick] Consider renaming ANIMATION_DURATION to something like NAVIGATION_THROTTLE_MS or ANIMATION_DURATION_MS to clarify that it serves both as the animation duration and the cooldown interval.
	private static final int ANIMATION_DURATION = 300;

Comment thread src/main/java/org/mastodon/views/bdv/overlay/OverlayNavigation.java Outdated
@stefanhahmann stefanhahmann force-pushed the bdv-to-frequent-navigation-deadlock branch from a17c539 to be02e00 Compare July 11, 2025 11:27
Reasoning: Big Data Viewer may get stuck, if navigation requests are sent to it too frequently
@stefanhahmann stefanhahmann force-pushed the bdv-to-frequent-navigation-deadlock branch from be02e00 to b5ef925 Compare July 11, 2025 11:37
@stefanhahmann stefanhahmann requested a review from tinevez July 11, 2025 11:44
@stefanhahmann stefanhahmann changed the title Fix Bdv to frequent navigation deadlock Fix Bdv too frequent navigation deadlock Jul 11, 2025
@tinevez
Copy link
Copy Markdown
Contributor

tinevez commented Jul 12, 2025

This is an horrid bug and a sensitive part of the code.
I would like to have the review of @tpietzsch here instead of mine.

@tinevez tinevez requested a review from tpietzsch July 12, 2025 21:08
@tpietzsch
Copy link
Copy Markdown
Contributor

I'll look at it during the celltrackathon

@stefanhahmann
Copy link
Copy Markdown
Collaborator Author

stefanhahmann commented Aug 21, 2025

Just a reminder, since users seem to be running into this bug quite frequently, when heavily using mastodon..

@tinevez @tpietzsch

@tinevez
Copy link
Copy Markdown
Contributor

tinevez commented Sep 8, 2025

I will merge it now and make a new release.
We can go back to this PR if we need to revert it should a fix in the upstream code be done.

@tinevez tinevez merged commit c029b9d into mastodon-sc:dev Sep 8, 2025
0 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mastodon freezes when navigating too quickly with connected BDV

4 participants