Title: @angular/ssr: an aborted request rejects `handle()` but the render keeps running · Issue #34567 · angular/angular-cli · GitHub
Open Graph Title: @angular/ssr: an aborted request rejects `handle()` but the render keeps running · Issue #34567 · angular/angular-cli
X Title: @angular/ssr: an aborted request rejects `handle()` but the render keeps running · Issue #34567 · angular/angular-cli
Description: Which @angular/* package(s) are the source of the bug? platform-server Is this a regression? No Description AngularServerApp.handle() wraps handleRendering() in promiseWithAbort(…, request.signal, …) (packages/angular/ssr/src/app.ts). Wh...
Open Graph Description: Which @angular/* package(s) are the source of the bug? platform-server Is this a regression? No Description AngularServerApp.handle() wraps handleRendering() in promiseWithAbort(…, request.signal, ...
X Description: Which @angular/* package(s) are the source of the bug? platform-server Is this a regression? No Description AngularServerApp.handle() wraps handleRendering() in promiseWithAbort(…, request.signal, ...
Opengraph URL: https://github.com/angular/angular-cli/issues/34567
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@angular/ssr: an aborted request rejects `handle()` but the render keeps running","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nplatform-server\n\n### Is this a regression?\n\nNo\n\n### Description\n\n`AngularServerApp.handle()` wraps `handleRendering()` in `promiseWithAbort(…, request.signal, …)` (`packages/angular/ssr/src/app.ts`). When the signal aborts, the returned promise rejects, but nothing stops the render: the platform `renderAngular()` created stays alive, its HTTP calls keep going, and the app goes on rendering a page nobody will receive.\n\nThis makes `request.signal` unusable as a render timeout. A server that caps renders (to answer 503 before the proxy's own timeout, and to limit how many renders run at once) gets its promise back on time while the work piles up in the background. With a slow backend, every abandoned render is still running when the next batch starts.\n\nReproduction: a route whose component issues an `HttpClient` GET to a backend that answers after 60 s. Call `engine.handle(new Request(url, { signal: AbortSignal.timeout(5_000) }))`. `handle()` rejects at 5 s; the backend still sees the request run to completion, and any request the app makes after that response still arrives. On our app (22.2.2), three renders aborted at 50 s made 8 more backend calls once the backend answered.\n\n**Suggested fix**\n\nPass the signal into `renderAngular()` and destroy the platform on abort, the same way it is destroyed after a normal render:\n\n```ts\n// utils/ng.ts, inside renderAngular(), after platformServer(...)\nconst onAbort = () => void asyncDestroyPlatform(platformRef);\nsignal?.addEventListener('abort', onAbort, { once: true });\n// ...and remove the listener in the existing finally / destroy paths\n```\n\nThe rest already works: destroying the app clears `PendingTasks`, so `whenStable()` settles; the `applicationRef.destroyed` check added in 730ae66 (\"handle platform destruction during rendering\") returns `{ hasNavigationError: true }`; and `FetchBackend` aborts its fetch when the destroyed app's subscriptions are torn down.\n\n**Workaround** (what we ship now), in `app.config.server.ts`:\n\n```ts\nprovideEnvironmentInitializer(() => {\n const signal = inject(REQUEST, { optional: true })?.signal;\n if (!signal) return;\n const platform = inject(PlatformRef);\n const destroy = () => setTimeout(() => platform.destroyed || platform.destroy());\n if (signal.aborted) return destroy();\n signal.addEventListener('abort', destroy, { once: true });\n inject(DestroyRef).onDestroy(() => signal.removeEventListener('abort', destroy));\n});\n```\n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n```true\n\n```\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\nAngular CLI : 22.2.2\nAngular : 22.2.2\nNode.js : 24.22.1\nPackage Manager : npm 11.19.1\nOperating System : darwin arm64\n\n┌───────────────────────────────────┬───────────────────┬───────────────────┐\n│ Package │ Installed Version │ Requested Version │\n├───────────────────────────────────┼───────────────────┼───────────────────┤\n│ @angular/aria │ 22.2.2 │ ^22.2.2 │\n│ @angular/build │ 22.2.2 │ ^22.2.2 │\n│ @angular/cdk │ 22.2.2 │ ^22.2.2 │\n│ @angular/cli │ 22.2.2 │ ^22.2.2 │\n│ @angular/common │ 22.2.2 │ ^22.2.2 │\n│ @angular/compiler │ 22.2.2 │ ^22.2.2 │\n│ @angular/compiler-cli │ 22.2.2 │ ^22.2.2 │\n│ @angular/core │ 22.2.2 │ ^22.2.2 │\n│ @angular/elements │ 22.2.2 │ ^22.2.2 │\n│ @angular/forms │ 22.2.2 │ ^22.2.2 │\n│ @angular/platform-browser │ 22.2.2 │ ^22.2.2 │\n│ @angular/platform-browser-dynamic │ 22.2.2 │ ^22.2.2 │\n│ @angular/platform-server │ 22.2.2 │ ^22.2.2 │\n│ @angular/router │ 22.2.2 │ ^22.2.2 │\n│ @angular/ssr │ 22.2.2 │ ^22.2.2 │\n│ ng-packagr │ 22.1.1 │ ^22.1.1 │\n│ rxjs │ 7.8.2 │ ~7.8.2 │\n│ typescript │ 6.0.3 │ ~6.0.3 │\n│ vitest │ 4.1.9 │ ^4.1.9 │\n└───────────────────────────────────┴───────────────────┴───────────────────┘\n```\n\n### Anything else?\n\n_No response_","author":{"url":"https://github.com/denisyilmaz","@type":"Person","name":"denisyilmaz"},"datePublished":"2026-10-28T13:12:19Z","url":"https://github.com/angular/angular-cli/issues/34567"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6be1e714-0707-40b7-8c0d-d1f8808d5bb7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E7B8:299992:F6119D:145A258:6B01D792 |
| html-safe-nonce | 1428ca4966b6f7e07eddd69bb45601546c4382bdae576c1e2632301c91a06a7e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFN0I4OjI5OTk5MjpGNjExOUQ6MTQ1QTI1ODo2QjAxRDc5MiIsInZpc2l0b3JfaWQiOiI3MzgwNTM5OTMwMDEyOTMxOTg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 28a2f6072aa96e0dda66f0c6850baa82308b40b6d02a8e16f1d6e52fa7379f7a |
| hovercard-subject-tag | issue:6079641479 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/34567/issue_layout |
| twitter:image | https://opengraph.githubassets.com/66679f2731175cd86b9182b9eae186db1e08a52c4a60e6753a8f1c8a3ec761bf/angular/angular-cli/issues/34567 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/66679f2731175cd86b9182b9eae186db1e08a52c4a60e6753a8f1c8a3ec761bf/angular/angular-cli/issues/34567 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? platform-server Is this a regression? No Description AngularServerApp.handle() wraps handleRendering() in promiseWithAbort(…, request.signal, ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | denisyilmaz |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width