Title: Request signal isn't aborted after garbage collection · Issue #55428 · nodejs/node · GitHub
Open Graph Title: Request signal isn't aborted after garbage collection · Issue #55428 · nodejs/node
X Title: Request signal isn't aborted after garbage collection · Issue #55428 · nodejs/node
Description: Bug Description Passing a signal to Request() and aborting it does not cause the underlying request signal to be aborted after it's been garbage collected. This leads to issues where you want to listen on the request signal even after th...
Open Graph Description: Bug Description Passing a signal to Request() and aborting it does not cause the underlying request signal to be aborted after it's been garbage collected. This leads to issues where you want to li...
X Description: Bug Description Passing a signal to Request() and aborting it does not cause the underlying request signal to be aborted after it's been garbage collected. This leads to issues where you want t...
Opengraph URL: https://github.com/nodejs/node/issues/55428
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Request signal isn't aborted after garbage collection","articleBody":"## Bug Description\r\n\r\nPassing a signal to Request() and aborting it does not cause the underlying request signal to be aborted after it's been garbage collected. This leads to issues where you want to listen on the request signal even after the request itself falls out of scope - e.g., the request is instantiated with an abort controller signal and downstream code is waiting for that signal to be aborted via `request.signal`.\r\n\r\n## Reproducible By\r\n\r\nRun the following using `node --expose-gc main.js`:\r\n\r\n```js\r\nconst ac = new AbortController();\r\n\r\nac.signal.addEventListener(\"abort\", () => {\r\n console.log(\"ac signal aborted\");\r\n});\r\n\r\nconst request = new Request(\"https://google.ca\", { signal: ac.signal });\r\n\r\nrequest.signal.addEventListener(\"abort\", () => {\r\n console.log(\"request signal aborted\");\r\n});\r\n\r\nsetTimeout(() => {\r\n global.gc();\r\n ac.abort();\r\n}, 0);\r\n```\r\n\r\n## Expected Behavior\r\n`ac signal aborted` **and** `request signal aborted` should be logged to the console.\r\n\r\nInstead, only `ac signal aborted` is logged.\r\n\r\n## Environment\r\n\r\nLatest node and undici. Tried it in some older versions as well.\r\n\r\n### Additional context\r\n\r\nA few folks are running into this while trying to close event stream requests in the remix web framework. The underlying requests are never closed because the signal doesn't get aborted.","author":{"url":"https://github.com/jvaill","@type":"Person","name":"jvaill"},"datePublished":"2024-09-25T21:48:01Z","url":"https://github.com/nodejs/node/issues/55428"}
| 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:978ae3bd-86dd-c064-d56d-4b1d88405f02 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9934:3B3F35:D8808B:11C888D:6AED5655 |
| html-safe-nonce | ff3c644a22d8f1af8d2a783de1733125cada590c13bd42fc1c0001bc03680f7f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTM0OjNCM0YzNTpEODgwOEI6MTFDODg4RDo2QUVENTY1NSIsInZpc2l0b3JfaWQiOiI1OTI2NjMyODA4MTMyNzI4NDA1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | e059c1f19df8f74844977f037cbe6b0de212ad6ff90471f7192a95386e9de8d9 |
| hovercard-subject-tag | issue:2595225840 |
| 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/55428/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3363c040babeef9accc83f34690b0405c1c431dc07e141f936eea7d1e32d3c69/nodejs/node/issues/55428 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3363c040babeef9accc83f34690b0405c1c431dc07e141f936eea7d1e32d3c69/nodejs/node/issues/55428 |
| og:image:alt | Bug Description Passing a signal to Request() and aborting it does not cause the underlying request signal to be aborted after it's been garbage collected. This leads to issues where you want to li... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jvaill |
| 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