Title: AbortSignal.any() causes memory leak · Issue #54614 · nodejs/node · GitHub
Open Graph Title: AbortSignal.any() causes memory leak · Issue #54614 · nodejs/node
X Title: AbortSignal.any() causes memory leak · Issue #54614 · nodejs/node
Description: Version v22.6.0 Platform Microsoft Windows NT 10.0.22631.0 x64 Linux ****** 4.4.0-22621-Microsoft #3672-Microsoft Fri Jan 01 08:00:00 PST 2016 x86_64 x86_64 x86_64 GNU/Linux Subsystem https://nodejs.org/api/globals.html#class-abortsignal...
Open Graph Description: Version v22.6.0 Platform Microsoft Windows NT 10.0.22631.0 x64 Linux ****** 4.4.0-22621-Microsoft #3672-Microsoft Fri Jan 01 08:00:00 PST 2016 x86_64 x86_64 x86_64 GNU/Linux Subsystem https://nodej...
X Description: Version v22.6.0 Platform Microsoft Windows NT 10.0.22631.0 x64 Linux ****** 4.4.0-22621-Microsoft #3672-Microsoft Fri Jan 01 08:00:00 PST 2016 x86_64 x86_64 x86_64 GNU/Linux Subsystem https://nodej...
Opengraph URL: https://github.com/nodejs/node/issues/54614
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AbortSignal.any() causes memory leak","articleBody":"### Version\n\nv22.6.0\n\n### Platform\n\n```text\nMicrosoft Windows NT 10.0.22631.0 x64\r\nLinux ****** 4.4.0-22621-Microsoft #3672-Microsoft Fri Jan 01 08:00:00 PST 2016 x86_64 x86_64 x86_64 GNU/Linux\n```\n\n\n### Subsystem\n\nhttps://nodejs.org/api/globals.html#class-abortsignal\n\n### What steps will reproduce the bug?\n\nRun this and watch memory usage. \r\n \r\n\r\n```javascript\r\nconst formatMemoryUsage = (data) =\u003e `${Math.round(data / 1024 / 1024 * 100) / 100} MB`;\r\n\r\nlet memoryData = process.memoryUsage();\r\nconsole.log('Mem before loop', formatMemoryUsage(memoryData.rss));\r\n\r\nfor (let i = 0; true; i++) {\r\n const abortController = new AbortController();\r\n const signal = abortController.signal;\r\n const composedSignal = AbortSignal.any([signal]);\r\n\r\n if (i === 1000000) {\r\n break;\r\n }\r\n}\r\n\r\nmemoryData = process.memoryUsage();\r\nconsole.log('Mem after 1 million iteration', formatMemoryUsage(memoryData.rss));\r\n```\r\n\r\nThis is what I get on my local machine \r\n\n\n### How often does it reproduce? Is there a required condition?\n\nAlways reproducible as far as I can tell\n\n### What is the expected behavior? Why is that the expected behavior?\n\nMemory post loop execution should be fairly equivalent to the first log but somehow the `const composedSignal = AbortSignal.any([signal]);` does not get cleaned up from memory, I would expect this to get cleaned properly or if this is the intended behavior to have a clear warning in the documentation. \n\n### What do you see instead?\n\nWe see a memory leak that will eventually lead to an out of memory error. \n\n### Additional information\n\nThis has been tested on Node 22.6 on different machine and both Windows + Unix versions. Happy to provide more details if needed ","author":{"url":"https://github.com/Furzel","@type":"Person","name":"Furzel"},"datePublished":"2024-08-28T17:16:11.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/54614/node/issues/54614"}
| 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:19583eef-e7ee-433f-c9d1-d35ed2b9b846 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A8AE:2BE1C0:8A478:BA72C:6A4C108E |
| html-safe-nonce | 3e4f56250051405843ab505965eb3890c55153767beb6cc010c8201a544ef2e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBOEFFOjJCRTFDMDo4QTQ3ODpCQTcyQzo2QTRDMTA4RSIsInZpc2l0b3JfaWQiOiI1MzQ5NTQ1NTIzMTY5NDY0NDYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5fa119c0a5c6cb12d50ec91e2e13cb111cef928de686b3b85a1c73a6d7ff5ad9 |
| hovercard-subject-tag | issue:2492621511 |
| 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/54614/issue_layout |
| twitter:image | https://opengraph.githubassets.com/21b0714a31f8b4e35e821f4c1882529b51eca5fa63c351fc0b3d38329ff4d15c/nodejs/node/issues/54614 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/21b0714a31f8b4e35e821f4c1882529b51eca5fa63c351fc0b3d38329ff4d15c/nodejs/node/issues/54614 |
| og:image:alt | Version v22.6.0 Platform Microsoft Windows NT 10.0.22631.0 x64 Linux ****** 4.4.0-22621-Microsoft #3672-Microsoft Fri Jan 01 08:00:00 PST 2016 x86_64 x86_64 x86_64 GNU/Linux Subsystem https://nodej... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Furzel |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0ccfc9e5281bfe12e38a4d632dc422843e4d5b6757917f7efda2f6567d72fea9 |
| 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 | 18812876666a23a0912556e224383baa4c84cf8e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width