Skip to content

Don't schedule live-region timers during SSR (30 s login error page) - #207

Open
kosarko wants to merge 1 commit into
clarin-v7from
fix/login-error-ssr-stall
Open

kosarko wants to merge 1 commit into
clarin-v7from
fix/login-error-ssr-stall

Conversation

@kosarko

@kosarko kosarko commented Nov 26, 2026

Copy link
Copy Markdown
Member

Problem description

Server-side rendering of /login?error=shibboleth-authentication-failed, the failure page for Shibboleth logins and now also for failed OIDC logins, takes ~30 s. Every other login URL renders in under a second.

Analysis

LogInPasswordComponent.checkIfHasLoginError() raises a notification for this error value. The notifications board passes the notification content to LiveRegionService.addMessage(), which starts an RxJS timer(liveRegion.messageTimeOutDurationMs) to clear the message again. That value defaults to 30000. The timer runs inside the Angular zone, so during SSR the zone does not become stable until it fires, and the response is only sent after 30 s.

This is not specific to the login page: any notification raised during SSR adds the full live-region timeout to that render. The service code comes unchanged from upstream (7.6.5).

Proof on a deployed instance, with no code change: the anonymous accessibility cookie overrides the live-region timeout, and the render time tracks it exactly.

dsAccessibilityCookie liveRegionTimeOut render time
(default 30000) 30.3 s
1000 1.35 s
5000 5.27 s
12000 12.98 s

Fix: addMessage() returns early on the server (isPlatformServer): it doesn't store the message and doesn't start the timer. A screen reader only exists in the browser, which re-adds the message when the app boots client-side, so client behaviour is unchanged. The SSR HTML is byte-identical before and after; the notification itself still renders server-side.

Ruled out: the notification component's own countdown. A timeOut of -1 is clamped to 0 by the board, so the countdown never starts, and it runs outside the zone anyway.

Testing

  • Local SSR server bundle against a remote backend, before and after the fix: /login?error=shibboleth-authentication-failed went from 30.1 s / 30.3 s to 0.12 s, the same as /login and /login?error=foo.
  • New unit test: on the server, addMessage stores nothing and leaves no pending timer (fakeAsync). It fails without the fix.
  • Affected specs (live-region, notifications, log-in-password, search-facet-option, dynamic-form-array, item-bitstreams): 78/78 pass. eslint on the changed files is clean.

Sync verification

No translation files changed.

Manual Testing (if applicable)

Copilot review

  • Requested review from Copilot

Every notification raised during server-side rendering is announced via
LiveRegionService.addMessage(), which starts an RxJS timer to clear the
message after liveRegion.messageTimeOutDurationMs (30 s by default). The
timer runs inside the Angular zone, so the zone never becomes stable and
the SSR response is only sent once it fires.

This made /login?error=shibboleth-authentication-failed (the Shibboleth
and OIDC login failure page, which raises a notification on init) take
~30 s to render instead of ~0.1 s.

On the server, skip the live region entirely: there is no screen reader
to announce to, and the browser announces the notification once the app
boots client-side.
@kosarko
kosarko requested a balanced review from Copilot November 26, 2026 16:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active issues were identified in the reviewed SSR live-region timer changes and their accompanying coverage.

No open issues 🎉

Review effort: Lite

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.

2 participants