Title: proposal: add req.signal (AbortSignal) for automatic client disconnect detection · Issue #62481 · nodejs/node · GitHub
Open Graph Title: proposal: add req.signal (AbortSignal) for automatic client disconnect detection · Issue #62481 · nodejs/node
X Title: proposal: add req.signal (AbortSignal) for automatic client disconnect detection · Issue #62481 · nodejs/node
Description: What is the problem this feature will solve? Currently, when we handle HTTP requests with async operations (such as DB queries or fetch calls), there isn't a straightforward way to cancel pending work if a client disconnects. The common ...
Open Graph Description: What is the problem this feature will solve? Currently, when we handle HTTP requests with async operations (such as DB queries or fetch calls), there isn't a straightforward way to cancel pending w...
X Description: What is the problem this feature will solve? Currently, when we handle HTTP requests with async operations (such as DB queries or fetch calls), there isn't a straightforward way to cancel pendi...
Opengraph URL: https://github.com/nodejs/node/issues/62481
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"proposal: add req.signal (AbortSignal) for automatic client disconnect detection","articleBody":"### What is the problem this feature will solve?\n\nCurrently, when we handle HTTP requests with async operations (such as DB queries or fetch calls), there isn't a straightforward way to cancel pending work if a client disconnects. The common workaround is to manually wire up `req.on('close')` or check `req.destroyed`:\n\n```js\nserver.on('request', async (req, res) => {\n const ac = new AbortController();\n req.on('close', () => ac.abort());\n\n const data = await fetch('https://slow-api.com', { signal: ac.signal });\n res.end(JSON.stringify(data));\n});\n```\n\nThis is boilerplate that every server framework ends up reimplementing.\n\nDesign considerations\n\nLazy initialization `AbortController` only created when `req.signal` is accessed (zero overhead for code that doesn't use it)\nSocket close = abort no conditional logic, signal aborts whenever the socket closes\n`_destroy` integration `req.destroy()` also triggers abort\n`configurable: true` allows framework override\nHTTP/2 parity `Http2ServerRequest` should eventually get the same property (follow-up)\n\nPrior art\n\nWeb Fetch API: `Request.signal`\nDeno: `request.signal` on `Deno.serve()` handler\n\n@nodejs/http @nodejs/http2 \n\n\n### What is the feature you are proposing to solve the problem?\n\nadd a lazy `signal` getter to `IncomingMessage` that returns an `AbortSignal` which aborts when the underlying socket closes:\n\n```js\nserver.on('request', async (req, res) => {\n const data = await fetch('https://slow-api.com', { signal: req.signal });\n res.end(JSON.stringify(data));\n});\n```\n\n### What alternatives have you considered?\n\n_No response_","author":{"url":"https://github.com/mertcanaltin","@type":"Person","name":"mertcanaltin"},"datePublished":"2026-03-28T20:32:45Z","url":"https://github.com/nodejs/node/issues/62481"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| 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:577cc54c-2597-fdc6-cdce-882dcbf16dbe |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B83E:2463B8:19CD0DD:21DD57E:6AED8BE9 |
| html-safe-nonce | 69d1d31cc1e40c764d01f0093258512bfec8e86836a3cb65301bbb4a31895b5b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODNFOjI0NjNCODoxOUNEMEREOjIxREQ1N0U6NkFFRDhCRTkiLCJ2aXNpdG9yX2lkIjoiNjUwNzk2MzM2NjE1NTA2MjI0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f8c1e5d7acdbdfb2a17f5b3f52744bebaf03dc14ca5ad0d0e56eb9e275017d91 |
| hovercard-subject-tag | issue:4161578462 |
| 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/nodejs/node/62481/issue_layout |
| twitter:image | https://opengraph.githubassets.com/69501954e0f78b9c59f611895f215e3c25a60674b8c11764b25528e4500e9f2c/nodejs/node/issues/62481 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/69501954e0f78b9c59f611895f215e3c25a60674b8c11764b25528e4500e9f2c/nodejs/node/issues/62481 |
| og:image:alt | What is the problem this feature will solve? Currently, when we handle HTTP requests with async operations (such as DB queries or fetch calls), there isn't a straightforward way to cancel pending w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mertcanaltin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| 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 | 9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width