René's URL Explorer Experiment


Title: AbortSignal.any() leaks when any of the provided signal is long-lived · Issue #55351 · nodejs/node · GitHub

Open Graph Title: AbortSignal.any() leaks when any of the provided signal is long-lived · Issue #55351 · nodejs/node

X Title: AbortSignal.any() leaks when any of the provided signal is long-lived · Issue #55351 · nodejs/node

Description: Version v22.9.0 Platform Microsoft Windows NT 10.0.22631.0 x64 Subsystem No response What steps will reproduce the bug? const ac = new AbortController(); let i = 0; function run() { AbortSignal.any([ac.signal]); if (++i % 100_000 === 0) ...

Open Graph Description: Version v22.9.0 Platform Microsoft Windows NT 10.0.22631.0 x64 Subsystem No response What steps will reproduce the bug? const ac = new AbortController(); let i = 0; function run() { AbortSignal.any...

X Description: Version v22.9.0 Platform Microsoft Windows NT 10.0.22631.0 x64 Subsystem No response What steps will reproduce the bug? const ac = new AbortController(); let i = 0; function run() { AbortSignal.any...

Opengraph URL: https://github.com/nodejs/node/issues/55351

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AbortSignal.any() leaks when any of the provided signal is long-lived","articleBody":"### Version\n\nv22.9.0\n\n### Platform\n\n```text\nMicrosoft Windows NT 10.0.22631.0 x64\n```\n\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\n```js\r\nconst ac = new AbortController();\r\n\r\nlet i = 0;\r\nfunction run() {\r\n    AbortSignal.any([ac.signal]);\r\n    if (++i % 100_000 === 0) {\r\n        const mem = process.memoryUsage().rss / 1024 / 1024;\r\n        const kDependantSignals = Object.getOwnPropertySymbols(ac.signal).filter(\r\n            (s) =\u003e s.toString() === 'Symbol(kDependantSignals)'\r\n        )[0];\r\n        const signals = ac.signal[kDependantSignals];\r\n        console.log(`${i} - ${mem.toFixed(2)} MiB - ${signals?.size} signals`);\r\n    }\r\n    setImmediate(run);\r\n}\r\nrun();\r\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nAbortSignal.any should not case memory leaks\n\n### What do you see instead?\n\n```\r\n❯ node ..\\test.js\r\nnode .\\test.js\r\n100000 - 82.29 MiB - 100000 signals\r\n200000 - 97.98 MiB - 200000 signals\r\n300000 - 126.98 MiB - 300000 signals\r\n400000 - 131.91 MiB - 400000 signals\r\n500000 - 152.07 MiB - 500000 signals\r\n600000 - 162.52 MiB - 600000 signals\r\n700000 - 208.69 MiB - 700000 signals\r\n800000 - 219.15 MiB - 800000 signals\r\n900000 - 221.80 MiB - 900000 signals\r\n1000000 - 244.98 MiB - 1000000 signals\r\n1100000 - 285.09 MiB - 1100000 signals\r\n1200000 - 265.71 MiB - 1200000 signals\r\n1300000 - 265.71 MiB - 1300000 signals\r\n1400000 - 311.45 MiB - 1400000 signals\r\n1500000 - 378.47 MiB - 1500000 signals\r\n1600000 - 377.95 MiB - 1600000 signals\r\n1700000 - 378.01 MiB - 1700000 signals\r\n1800000 - 378.65 MiB - 1800000 signals\r\n1900000 - 406.42 MiB - 1900000 signals\r\n2000000 - 423.68 MiB - 2000000 signals\r\n2100000 - 503.71 MiB - 2100000 signals\r\n2200000 - 503.72 MiB - 2200000 signals\r\n2300000 - 464.14 MiB - 2300000 signals\r\n2400000 - 464.20 MiB - 2400000 signals\r\n2500000 - 464.20 MiB - 2500000 signals\r\n2600000 - 464.20 MiB - 2600000 signals\r\n2700000 - 481.40 MiB - 2700000 signals\r\n2800000 - 548.31 MiB - 2800000 signals\r\n2900000 - 611.93 MiB - 2900000 signals\r\n3000000 - 678.66 MiB - 3000000 signals\r\n3100000 - 685.27 MiB - 3100000 signals\r\n3200000 - 685.36 MiB - 3200000 signals\r\n3300000 - 685.36 MiB - 3300000 signals\r\n3400000 - 685.36 MiB - 3400000 signals\r\n3500000 - 685.36 MiB - 3500000 signals\r\n3600000 - 686.01 MiB - 3600000 signals\r\n3700000 - 686.08 MiB - 3700000 signals\r\n3800000 - 748.08 MiB - 3800000 signals\r\n3900000 - 775.59 MiB - 3900000 signals\r\n...\r\n```\n\n### Additional information\n\nIt's pretty clear that `AbortSignal.any` attaches the combined signal to all its parent signals. But it only gets removed if the parent signals are actually aborted. If there is a long living signal among the parents, for instance something like a SIGINT handler, then it keeps accumulating WeakRefs to no longer existing `AbortSignal`s.\r\n\r\nRelated issues:\r\n- Related deno issue: https://github.com/denoland/deno/issues/24842\r\n- Partly related issue: https://github.com/nodejs/node/issues/48419\r\n  - Particularly case 3 of https://github.com/nodejs/node/issues/48419#issuecomment-2215484061\r\n- Different issue: https://github.com/nodejs/node/issues/55328\r\n  - Another leak when not properly removing listeners from `AbortSignal` returned by `AbortSignal.any`\r\n- Probably not an issue at all: https://github.com/nodejs/node/issues/54614","author":{"url":"https://github.com/mika-fischer","@type":"Person","name":"mika-fischer"},"datePublished":"2024-10-10T14:43:52.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/55351/node/issues/55351"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:3368338d-14ad-c575-ec54-443d7710c636
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idACFC:14D8D:9421F4:C8595E:6A4C4667
html-safe-nonced358a2f448e25acd87161c3ab80f3cece2e8c3730d029af625a0e5763b2dd166
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQ0ZDOjE0RDhEOjk0MjFGNDpDODU5NUU6NkE0QzQ2NjciLCJ2aXNpdG9yX2lkIjoiMjIwOTIzMzEyNDc0MjQxNTk3NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac611526c240f3e9b1d54b0a2fc503fe78a8d31c10cd2b0f91948105c74af438f7
hovercard-subject-tagissue:2579077659
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/55351/issue_layout
twitter:imagehttps://opengraph.githubassets.com/47f91d67fd6dd3490de8110ae4c6f62307a7de6dd850db2a50b619efac0987a2/nodejs/node/issues/55351
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/47f91d67fd6dd3490de8110ae4c6f62307a7de6dd850db2a50b619efac0987a2/nodejs/node/issues/55351
og:image:altVersion v22.9.0 Platform Microsoft Windows NT 10.0.22631.0 x64 Subsystem No response What steps will reproduce the bug? const ac = new AbortController(); let i = 0; function run() { AbortSignal.any...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemika-fischer
hostnamegithub.com
expected-hostnamegithub.com
None3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3996b3b83990e134be6c099ab9a7f48f140ae80f
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/55351#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F55351
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F55351
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/55351
Reloadhttps://github.com/nodejs/node/issues/55351
Reloadhttps://github.com/nodejs/node/issues/55351
Please reload this pagehttps://github.com/nodejs/node/issues/55351
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/55351
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 967 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
AbortSignal.any() leaks when any of the provided signal is long-livedhttps://github.com/nodejs/node/issues/55351#top
abortcontrollerIssues and PRs related to the AbortController APIhttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22abortcontroller%22
confirmed-bugIssues with confirmed bugs.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
https://github.com/mika-fischer
mika-fischerhttps://github.com/mika-fischer
on Oct 10, 2024https://github.com/nodejs/node/issues/55351#issue-2579077659
AbortSignal.any() leaks when any of the provided signal is long-lived  denoland/deno#24842https://github.com/denoland/deno/issues/24842
AbortSignal.any() not destroyed when goes out of scope #48419https://github.com/nodejs/node/issues/48419
AbortSignal.any() not destroyed when goes out of scope #48419 (comment)https://github.com/nodejs/node/issues/48419#issuecomment-2215484061
AbortController/AbortSignal memory leak #55328https://github.com/nodejs/node/issues/55328
AbortSignal.any() causes memory leak #54614https://github.com/nodejs/node/issues/54614
abortcontrollerIssues and PRs related to the AbortController APIhttps://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22abortcontroller%22
confirmed-bugIssues with confirmed bugs.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22confirmed-bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.