Fix infinite route-loader spinner from per-navigation root cache inva…#5936
Open
naomigassler wants to merge 1 commit into
Open
Fix infinite route-loader spinner from per-navigation root cache inva…#5936naomigassler wants to merge 1 commit into
naomigassler wants to merge 1 commit into
Conversation
…lidation BrowserInitService invalidated the root /server/api endpoint cache on every NavigationStart. That marks the root request stale (RootDataService .invalidateRootCache -> RequestService.setStaleByHref). HALEndpointService .getEndpointMapAt, used by getEndpoint() for every data request, discards a stale root via filter(rd => !rd.isStale), and its re-fetch can lose the race with the next invalidation, so getEndpoint() never resolves, the route resolver never completes, and the route loader spins forever. The root endpoint map is static between navigations, so invalidating it on every navigation is unnecessary. Remove the per-NavigationStart invalidation and keep the one-time invalidation at app init; backend availability is still established there and surfaces through normal request failures. Fixes DSpace#3584, DSpace#3697.
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.
PR: Fix infinite route-loader spinner on navigation (stale root-endpoint cache deadlock)
Target branch:
DSpace/dspace-angular:mainCloses / relates to: #3584, #3697, #5855
Description
BrowserInitServiceinvalidates the root API endpoint cache on everyNavigationStart. On a subsequent request,HALEndpointService.getEndpointMapAt(hit on essentially every request via
getEndpoint()) discards the now-staleroot
/server/apientry and triggers a re-fetch that can deadlock — theroute resolver never completes,
NavigationEndnever fires, and theds-base-rootroute-loader spinner hangs indefinitely on a frozen store.The root endpoint map is effectively static between navigations, so
re-invalidating it on each
NavigationStartis unnecessary. Backend-downdetection still happens at init and through normal request-failure handling.
Root cause
BrowserInitService→invalidateRootCache()on everyNavigationStart./server/apiendpoint cache stale.getEndpoint()→getEndpointMapAtdiscards the stale root → re-fetchdeadlocks → resolver never resolves →
NavigationEndnever fires → spinnerhangs forever.
intermittent).
Steps to reproduce
Communities & Collections).
Reproducible on a small instance (~7k items) — not load- or scale-dependent.
Higher REST/proxy latency increases the frequency.
Fix
Remove the per-
NavigationStartinvalidateRootCache()call inbrowser-init.service.ts; keep the one-time invalidation at init. No behaviorchange to backend-down detection.
How to test
always resolves.
app still detects/handles it (init-time + request-failure paths).
Tests
Added a spec asserting the root endpoint cache is invalidated once at init
and not on subsequent
NavigationStartevents.Checklist notes
yarn lintandyarn check-circ-deps.