Infinite route-loader spinner: per-navigation invalidateRootCache() deadlocks getEndpointMapAt when the root endpoint goes stale
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
Describe the bug
After the UI has been open a while, navigating to / revisiting a page can leave the app stuck on the route-loader spinner (<ds-loading> in ds-base-root, driven by AppComponent.isRouteLoading$) forever. The shell stays responsive (navbar, sidebar, overlays work); a full reload or clicking any other in-app link recovers it, but the routed content never renders. While stuck: nothing is pending on the network, the NgRx store is frozen, and CPU/memory are idle — a logical deadlock, not a loop or leak. It is much harder to reproduce with DevTools open and far worse in production than on a local dev server (cf. #3584, #3697).
To Reproduce
Authenticated, ideally behind a reverse proxy / with non-trivial REST latency:
- Load a content page (e.g. a Community/Collection).
- Navigate around / wait a bit.
- Navigate back (or keep navigating). The spinner appears and never resolves; reload or any other link recovers it. Higher REST latency → more reliable (essentially every revisit through a proxy).
Expected behavior
Navigation completes and the page renders; a transiently-stale root endpoint must not wedge navigation indefinitely.
Root cause
BrowserInitService.listenForRouteChanges()callsrootDataService.invalidateRootCache()on everyNavigationStart→RequestService.setStaleByHref('/server/api')marks the root request stale (regardless of its TTL).HALEndpointService.getEndpointMapAt()— used bygetEndpoint(), which every data request needs — doesfilter(rd => !rd.isStale), discarding the stale root; itstap(... getEndpointMapAt())re-request does not reliably produce a fresh one, so it never emits.- So
getEndpoint()never resolves → the route resolver never completes → the router never emitsNavigationEnd→isRouteLoading$(cleared only onNavigationEnd/Cancel) staystrue→ the route loader spins forever, store frozen.
Evidence (frozen store at the hang): root /server/api is SuccessStale with TTL not expired (explicitly invalidated, not aged out); 0 requests pending (nothing re-fetching); the only RequestStaleAction caller is setStaleByHref ← invalidateRootCache ← the NavigationStart subscription. Consistent with #2669 (invalidateRootCache ↔ HALEndpointService stale interaction) after #2510 (7.6.1) made HAL endpoint requests stale-able.
Proposed fix
The root endpoint map is static between navigations, so the per-NavigationStart invalidation is unnecessary. Removing it eliminates the deadlock (backend availability is still established at app init and surfaces through normal request failures):
import {
- NavigationStart,
Router,
} from '@angular/router';
@@ listenForRouteChanges()
protected listenForRouteChanges(): void {
- // we'll always be too late for the first NavigationStart event with the router subscribe below,
- // so this statement is for the very first route operation.
+ // Invalidate the root endpoint cache once, for the very first route operation.
this.rootDataService.invalidateRootCache();
-
- this.router.events.pipe(
- filter(event => event instanceof NavigationStart),
- ).subscribe(() => {
- this.rootDataService.invalidateRootCache();
- });
}
(Alternative, if the per-navigation backend check is to be kept: make getEndpointMapAt tolerate a stale-but-completed root, e.g. filter(rd => !rd.isStale || rd.hasCompleted), so a stale endpoint map is used while the tap() refreshes it — fixing the deadlock without changing the invalidation cadence.)
Verified: the change removes the hang and the E2E suite is unaffected.
Environment
- dspace-angular 9.3 (Angular 20.3);
listenForRouteChanges()/getEndpointMapAt()are unchanged onmainas of this report. - DSpace 9.3 REST backend behind an nginx reverse proxy; CSR (SSR disabled); reproduced in Safari and Firefox.
Related
#2669, #2510, #3584, #3697, #3888
- 主要语言
- TypeScript
- 星标
- 180
- 派生
- 577
- 平均合并
- 1 天 23 小时
- 30 天内合并 PR
- 95
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DSpace/dspace-angular 的其他 Issue
-
accessibility affects: 10.x affects: main bug ux
难度 2/5 1-3 小时 新手友好度 72/100
DSpace/dspace-angular#6531 · 1 条评论 ·
维护者通常 1 天内回复
-
accessibility affects: 10.x affects: main bug help wanted
难度 2/5 1-3 小时 新手友好度 66/100
DSpace/dspace-angular#6530 ·
维护者通常 1 天内回复
-
Submission Form Allows Deletion of All Repeating Item Entries可能已有人在做 @Rowan-McKereghan 于 5 天前认领。 未关闭affects: 8.x affects: 9.x bug component: submission
难度 2/5 1-3 小时 新手友好度 72/100
DSpace/dspace-angular#6511 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Visual issues with qualdrop fields可能已有人在做 @DanGastardelli 于 15 天前认领。 未关闭affects: 10.x affects: 9.x bug claimed: Acervos Digitais component: submission Difficulty: Low ux
难度 2/5 1-3 小时 新手友好度 66/100
DSpace/dspace-angular#6412 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Facet headings have incorrect clickable area to expand/collapse可能已有人在做 @jesielviana 于 12 天前认领。 未关闭accessibility affects: 10.x affects: 8.x affects: 9.x bug ux
难度 2/5 1-3 小时 新手友好度 72/100
DSpace/dspace-angular#6364 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 DSpace/dspace-angular 的全部 Issue
相似的 Issue
-
[analytics-core] getQueryParams does not decode `+` as space and truncates values containing `=`未关闭bug
难度 2/5 1-3 小时 新手友好度 82/100
amplitude/Amplitude-TypeScript#2179 · 1 条评论 ·
维护者通常 2 天内回复
-
ci good first issue severity: low
难度 2/5 1-3 小时 新手友好度 68/100
TMHSDigital/GH-Arcade#111 ·
-
AsnIntegerConverter.toASN coerces strings with +value, rounding integers outside safe-integer range未关闭
难度 2/5 1-3 小时 新手友好度 78/100
PeculiarVentures/asn1-schema#189 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100