Title: Angular SSR can crash `AngularAppEngine` servers with a single aborted request (22.2.6 regression) · Issue #34754 · angular/angular-cli · GitHub
Open Graph Title: Angular SSR can crash `AngularAppEngine` servers with a single aborted request (22.2.6 regression) · Issue #34754 · angular/angular-cli
X Title: Angular SSR can crash `AngularAppEngine` servers with a single aborted request (22.2.6 regression) · Issue #34754 · angular/angular-cli
Description: Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 22.2.5 Description Since @angular/ssr 22.2.6, a client that disconnects while a page is still render...
Open Graph Description: Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 22.2.5 Description Since @angular/ssr 22.2.6, a client that ...
X Description: Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 22.2.5 Description Since @angular/ssr 22.2.6, a client that ...
Opengraph URL: https://github.com/angular/angular-cli/issues/34754
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Angular SSR can crash `AngularAppEngine` servers with a single aborted request (22.2.6 regression)","articleBody":" \n\n### Is this a regression?\n\n- [x] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\n22.2.5\n\n### Description\n\n\nSince `@angular/ssr` 22.2.6, a client that disconnects while a page is still rendering can kill the server process when it runs on `AngularAppEngine`: plain `node:http`, Hono, H3, srvx, Deno or Bun. The Express server from `ng new --ssr` is fine, because `AngularNodeAppEngine` installs process-wide error handlers.\n\n#34568 made `renderAngular()` destroy the platform when `request.signal` aborts:\n\nhttps://github.com/angular/angular-cli/blob/72f44d79cb577821bbfa849f5bb3b41eee87c2ab/packages/angular/ssr/src/utils/ng.ts#L126-L129\n\nThe host still gets the usual `AbortError` and handles it. What kills the process is the work that was still running. The clearest case is an app initializer: once it settles, [`bootstrap()` reads the destroyed injector](https://github.com/angular/angular/blob/v22.2.6/packages/core/src/platform/bootstrap.ts#L143-L146), and the internal error handler [rethrows the `NG0205` from a `setTimeout`](https://github.com/angular/angular/blob/v22.2.6/packages/core/src/error_handler.ts#L155-L160) because the injector is destroyed. Neither the app nor the host's `try/catch` can catch that, so it doesn't matter how the initializer is written:\n\n| Pending when the client disconnects, on `AngularAppEngine` | Process |\n| --- | --- |\n| `provideAppInitializer` from its [usage notes](https://angular.dev/api/core/provideAppInitializer#usage-notes) | exit 1 |\n| the same wrapped in `try/catch` | exit 1 |\n| an initializer that only waits on a 100 ms timer | exit 1 |\n| `PendingTasks.run()` as the [zoneless guide](https://angular.dev/guide/zoneless#pendingtasks-for-server-side-rendering-ssr) shows it, awaiting an `HttpClient` call | exit 1 |\n| `firstValueFrom(http.get(...))` in `async ngOnInit()` (zoneless) | exit 1 |\n| `subscribe()`, resolvers, guards, `httpResource`, `resource()` | alive |\n| the `try/catch` initializer on 22.2.5, or on `AngularNodeAppEngine` | alive |\n\nThe `ngOnInit` row is the other path: `FetchBackend` [completes without a value](https://github.com/angular/angular/blob/v22.2.6/packages/common/http/src/fetch.ts#L267-L270) once the app is destroyed, so `firstValueFrom()` rejects with `EmptyError` and nobody holds that promise. `PendingTasks.run()` passes that error to the same internal error handler, so it's rethrown from a `setTimeout` too.\n\nIt doesn't take precise timing. Every abort that arrived while the server was waiting on its backend killed it, 310 out of 310 with backends from 1 ms to 1 s, and nginx with its default config passes the abort on. The other pages that were rendering go down too. With Docker's `restart: always`, one aborted request every two seconds left the site serving 312 pages a minute instead of 5,584.\n\n#34568 is right to stop the render, but the platform shouldn't be destroyed while that work is still pending, so the abort stays inside the promise `handle()` returns, the way it did on 22.2.5. `AngularAppEngine` is meant for platforms other than Node.js, so it can't count on `process.on()` handlers like `AngularNodeAppEngine` does.\n\n### Minimal Reproduction\n\n\nhttps://github.com/SkyZeroZx/angular-ssr-abort-crash-lab\n\n`ng new --ssr` with `provideHttpClient()`, `RenderMode.Server` on `**`, the SSR guide's non-Node entry on `node:http`, and a component that waits for its data during the render (`api.mjs` answers in 100 ms):\n\n```ts\nasync ngOnInit() {\n const { name } = await firstValueFrom(\n this.http.get\u003c{ name: string }>('http://127.0.0.1:4400/profile'),\n );\n this.profile.set(name);\n}\n```\n\n```sh\nnpm ci && npx ng build\nnode api.mjs &\nnode dist/aborted-render-process/server/server.mjs &\nsleep 2\ncurl -sS -o /dev/null -w \"%{http_code}\\n\" http://localhost:4000/\ncurl -sS -m 0.05 http://localhost:4000/\nsleep 1\ncurl -sS http://localhost:4000/\n```\n\n```text\n200\ncurl: (28) Operation timed out after 55 milliseconds with 0 bytes received\ncurl: (7) Failed to connect to localhost:4000 after 0 ms: Could not connect to server\n```\n\nThe initializer version is in `variants/initializer-trycatch`, and `cd docker && sh variants.sh initializer-trycatch` builds and runs it. The README has the rest.\n\n### Exception or Error\n\n```text\nThe try/catch initializer, development build:\n\ndist/aborted-render-process/server/main.server.mjs:4818\n throw e;\n ^\n\nRuntimeError: NG0205: Injector has already been destroyed. Find more at https://v22.angular.dev/errors/NG0205\n at assertNotDestroyed (dist/aborted-render-process/server/main.server.mjs:3546:11)\n at R3Injector.get (dist/aborted-render-process/server/main.server.mjs:3303:5)\n at dist/aborted-render-process/server/main.server.mjs:26095:38\n at async renderAngular (dist/aborted-render-process/server/main.server.mjs:43273:24)\n\n\nThe ngOnInit repro, development build:\n\nnode:internal/process/promises:394\n triggerUncaughtException(err, true /* fromPromise */);\n ^\nError\n at new EmptyErrorImpl (dist/aborted-render-process/server/main.server.mjs:1783:3)\n at Object.complete (dist/aborted-render-process/server/main.server.mjs:1802:18) {\n message: 'no elements in sequence'\n}\n```\n\n### Your Environment\n\n```text\n@angular/ssr 22.2.7\n@angular/core 22.2.6, also 22.3.0\nNode.js 24.16.0 on Windows 11, 24.22.3 in Docker\nAlso tried Hono 4.13, H3 2.0, srvx 1.0, Deno 2.9.8, Bun 1.4.4, nginx 1.30\n```\n\n### Anything else relevant?\n\n\nI think this is a vulnerability according to the [SECURITY.md](https://github.com/angular/angular-cli/blob/main/SECURITY.md), which says:\n\n> DoS attacks which waste server resources significantly beyond the cost of the attacker's request may be security issues.\n\nHere a single request crashes the server.\n \n","author":{"url":"https://github.com/SkyZeroZx","@type":"Person","name":"SkyZeroZx"},"datePublished":"2026-11-19T05:23:50Z","url":"https://github.com/angular/angular-cli/issues/34754"}
| 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:57075535-e2d4-7faa-f72d-1f0e8f38841b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8358:269AD9:2DB4184:3D0C887:6B01D5F3 |
| html-safe-nonce | 8a167c717fbb1d335157eecbd3b8f0499a336f53a09fbc8e9883f6747471db09 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MzU4OjI2OUFEOToyREI0MTg0OjNEMEM4ODc6NkIwMUQ1RjMiLCJ2aXNpdG9yX2lkIjoiNzgwMDEwMjMyMTkyNTU0NDgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 7205e2d1752b42787412d4c684a95c2e86d93984f1160ae3bc83762d11bca00c |
| hovercard-subject-tag | issue:6483021970 |
| 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/34754/issue_layout |
| twitter:image | https://opengraph.githubassets.com/f75696c6b25d68c2c0e43217356be20ab76af35289201402c1da7576933aa3eb/angular/angular-cli/issues/34754 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/f75696c6b25d68c2c0e43217356be20ab76af35289201402c1da7576933aa3eb/angular/angular-cli/issues/34754 |
| og:image:alt | Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was 22.2.5 Description Since @angular/ssr 22.2.6, a client that ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SkyZeroZx |
| 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