René's URL Explorer Experiment


Title: dns.lookup: pending promises grow unboundedly under sustained EAI_AGAIN load · Issue #62503 · nodejs/node · GitHub

Open Graph Title: dns.lookup: pending promises grow unboundedly under sustained EAI_AGAIN load · Issue #62503 · nodejs/node

X Title: dns.lookup: pending promises grow unboundedly under sustained EAI_AGAIN load · Issue #62503 · nodejs/node

Description: Version v24.14.1 Platform Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 (Debian forky/sid) Subsystem dns What steps will reproduce the bug? When dns.promises.lookup() is called repeatedly for a hostname that triggers EAI_AGAIN (e.g. a no...

Open Graph Description: Version v24.14.1 Platform Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 (Debian forky/sid) Subsystem dns What steps will reproduce the bug? When dns.promises.lookup() is called repeatedly for a hos...

X Description: Version v24.14.1 Platform Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 (Debian forky/sid) Subsystem dns What steps will reproduce the bug? When dns.promises.lookup() is called repeatedly for a hos...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"dns.lookup: pending promises grow unboundedly under sustained EAI_AGAIN load","articleBody":"### Version\n\nv24.14.1\n\n### Platform\n\n```text\nLinux 6.6.87.2-microsoft-standard-WSL2 x86_64 (Debian forky/sid)\n```\n\n### Subsystem\n\ndns\n\n### What steps will reproduce the bug?\n\nWhen `dns.promises.lookup()` is called repeatedly for a hostname that triggers `EAI_AGAIN` (e.g. a nonsense TLD like `'asd'`), `getaddrinfo` blocks its libuv thread for ~10 seconds before rejecting. Under sustained load, new lookups queue behind the blocked threads and the number of unresolved promises grows without bound.\n\nIn our production system this manifests as a memory leak: each pending promise holds references to the calling closure (in our case, per-conversation config objects), and none of them can be GC'd until `getaddrinfo` eventually returns.\n\n**Minimal reproduction** — save as `repro.mjs`:\n\n```js\nimport { lookup } from 'node:dns/promises';\n\nconst HOSTNAME = 'asd'; // triggers EAI_AGAIN\nconst INTERVAL_MS = 2000;\nconst TOTAL = 50;\n\nlet pending = 0;\nlet started = 0;\nlet settled = 0;\n\nfunction fire() {\n  const id = ++started;\n  ++pending;\n  const t0 = Date.now();\n  console.log(`[#${id}] started  (pending: ${pending})`);\n\n  lookup(HOSTNAME).then(\n    (result) => {\n      --pending;\n      ++settled;\n      console.log(`[#${id}] resolved ${result.address} after ${Date.now() - t0}ms  (pending: ${pending})`);\n    },\n    (err) => {\n      --pending;\n      ++settled;\n      console.log(`[#${id}] rejected ${err.code} after ${Date.now() - t0}ms  (pending: ${pending})`);\n    }\n  );\n}\n\nconst interval = setInterval(() => {\n  if (started >= TOTAL) {\n    clearInterval(interval);\n    return;\n  }\n  fire();\n}, INTERVAL_MS);\n\nsetInterval(() => {\n  console.log(`\\n--- status: started=${started} settled=${settled} pending=${pending} ---\\n`);\n}, 5000).unref();\n\nsetTimeout(() => {\n  console.log(`\\n=== FINAL: started=${started} settled=${settled} stuck=${pending} ===`);\n  if (pending > 0)\n    console.log(`LEAK CONFIRMED: ${pending} lookup(s) never settled.`);\n  else\n    console.log('No leak detected.');\n  process.exit(pending > 0 ? 1 : 0);\n}, TOTAL * INTERVAL_MS + 60_000);\n```\n\nRun:\n\n```\nnode repro.mjs\n```\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\nEach `lookup()` call should resolve or reject in bounded time, regardless of the hostname. Under sustained load, the number of pending (unresolved) promises should stay bounded — ideally proportional to the libuv thread pool size (`UV_THREADPOOL_SIZE`, default 4), not to the total number of requests issued.\n\n\n### What do you see instead?\n\n- Each `getaddrinfo` call for `'asd'` blocks a libuv thread for ~10 seconds before rejecting with `EAI_AGAIN`.\n- Only ~2 rejections return per 10-second cycle (thread pool saturation).\n- New lookups queue behind the blocked threads, so the pending count grows monotonically: 5 → 8 → 11 → 14 → 17 → 20 → …\n- Promises are never settled until their turn comes, which under continuous load may be never.\n\nSample output (trimmed):\n\n```\n[#1] started  (pending: 1)\n[#2] started  (pending: 2)\n[#3] started  (pending: 3)\n[#4] started  (pending: 4)\n[#5] started  (pending: 5)\n[#6] started  (pending: 6)\n[#1] rejected EAI_AGAIN after 10031ms  (pending: 5)\n[#7] started  (pending: 6)\n[#2] rejected EAI_AGAIN after 10014ms  (pending: 5)\n\n--- status: started=7 settled=2 pending=5 ---\n\n[#8] started  (pending: 6)\n...\n[#12] started  (pending: 9)\n[#4] rejected EAI_AGAIN after 16024ms  (pending: 8)\n\n--- status: started=12 settled=4 pending=8 ---\n\n...\n[#32] started  (pending: 21)\n[#12] rejected EAI_AGAIN after 40068ms  (pending: 20)\n\n--- status: started=32 settled=12 pending=20 ---\n```\n\nThe pending count never converges to zero. In a long-running server, this is effectively a memory leak because every queued promise retains references to its enclosing closure.\n\n\n### Additional information\n\n- `UV_THREADPOOL_SIZE` is unset (default 4).\n- The callback-based `dns.lookup()` shows the same behavior — this is a libuv/getaddrinfo issue, not specific to the promises API.\n- Hostnames that fail fast (e.g. `ENOTFOUND`) do not exhibit this problem.\n- The `EAI_AGAIN` timeout (~10s per attempt) appears to come from the system resolver's retry/timeout settings, but the queuing behind the fixed-size thread pool is what makes it unbounded.\n- A possible mitigation from Node's side: support `AbortSignal` in `dns.lookup()` / `dns.promises.lookup()` so callers can cancel stale lookups, or expose a configurable per-lookup timeout.\n","author":{"url":"https://github.com/orgads","@type":"Person","name":"orgads"},"datePublished":"2026-03-30T11:00:47Z","url":"https://github.com/nodejs/node/issues/62503"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:cc0d4979-61e7-8cfa-9dbd-cdc59ad4c9f8
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC25C:2D418D:21DFF1:2F4CF4:6AFBE243
html-safe-noncebfcb9a90ada1f5925285a2c6ba0a02ee374787e7d5a3c33aca958244522a2e8b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjVDOjJENDE4RDoyMURGRjE6MkY0Q0Y0OjZBRkJFMjQzIiwidmlzaXRvcl9pZCI6IjE0MjEzMDIxMzcxNDQyMDU4OTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0e2c522c38715e326901c4d5754874895f0f376609091d07759bdf7ca9ef1458
hovercard-subject-tagissue:4169743541
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/62503/issue_layout
twitter:imagehttps://opengraph.githubassets.com/ca40c96a3077a6997df9290e153d82126005a6e3141451adaabee6cd241c747e/nodejs/node/issues/62503
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ca40c96a3077a6997df9290e153d82126005a6e3141451adaabee6cd241c747e/nodejs/node/issues/62503
og:image:altVersion v24.14.1 Platform Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 (Debian forky/sid) Subsystem dns What steps will reproduce the bug? When dns.promises.lookup() is called repeatedly for a hos...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameorgads
hostnamegithub.com
expected-hostnamegithub.com
None744d4381b1c4dbd6d8736c7d7e5bbe7dc11217584e457a3555020c631764e8ec
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
releasedf859c48a4c8b4c0009c19bb4e82101aacb4b998
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/62503#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F62503
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F62503
Sign uphttps://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/62503
Reloadhttps://github.com/nodejs/node/issues/62503
Reloadhttps://github.com/nodejs/node/issues/62503
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues644 (644)https://github.com/nodejs/node/issues
Pull requests678 (678)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/62503
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/62503
#62599https://github.com/nodejs/node/pull/62599
dns.lookup: pending promises grow unboundedly under sustained EAI_AGAIN loadhttps://github.com/nodejs/node/issues/62503#top
#62599https://github.com/nodejs/node/pull/62599
https://github.com/orgads
orgadshttps://github.com/orgads
on Mar 30, 2026https://github.com/nodejs/node/issues/62503#issue-4169743541
orgadshttps://github.com/orgads
on Mar 31, 2026https://github.com/nodejs/node/issues/62503#event-24088238661
dns: support AbortSignal in dns.lookup() and dns.promises.lookup()https://github.com/orgads/node/commit/67e8f47b36f39df56d962aafb40728728673c109
67e8f47https://github.com/orgads/node/commit/67e8f47b36f39df56d962aafb40728728673c109
orgadshttps://github.com/orgads
on Apr 22, 2026https://github.com/nodejs/node/issues/62503#event-24741699046
dns: coalesce identical concurrent lookup() requestshttps://github.com/orgads/node/commit/6572e6ed8e43cce2b7afd608b52b93382c5bade0
6572e6ehttps://github.com/orgads/node/commit/6572e6ed8e43cce2b7afd608b52b93382c5bade0
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Jul 20, 2026https://github.com/nodejs/node/issues/62503#issuecomment-5019605374
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Jul 20, 2026https://github.com/nodejs/node/issues/62503#event-28198470037
https://github.com/orgads
orgadshttps://github.com/orgads
on Aug 1, 2026https://github.com/nodejs/node/issues/62503#issuecomment-5152866994
orgadshttps://github.com/orgads
on Aug 1, 2026https://github.com/nodejs/node/issues/62503#event-28824943506
dns: coalesce identical concurrent lookup() requestshttps://github.com/orgads/node/commit/7ea9614b5f86d5b9882f3814b251522c80208521
7ea9614https://github.com/orgads/node/commit/7ea9614b5f86d5b9882f3814b251522c80208521
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Aug 2, 2026https://github.com/nodejs/node/issues/62503#event-28832154740
orgadshttps://github.com/orgads
on Oct 26, 2026https://github.com/nodejs/node/issues/62503#event-34235641243
dns: coalesce identical concurrent lookup() requestshttps://github.com/orgads/node/commit/6e7026d6948d4a801b0994f0856a49c4d3f0f5b9
6e7026dhttps://github.com/orgads/node/commit/6e7026d6948d4a801b0994f0856a49c4d3f0f5b9
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Nov 1, 2026https://github.com/nodejs/node/issues/62503#issuecomment-6551597967
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Nov 1, 2026https://github.com/nodejs/node/issues/62503#event-34807317465
https://github.com/orgads
orgadshttps://github.com/orgads
on Nov 1, 2026https://github.com/nodejs/node/issues/62503#issuecomment-6552924768
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Nov 2, 2026https://github.com/nodejs/node/issues/62503#event-34865244428
nodejs-github-bothttps://github.com/nodejs-github-bot
completedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#62599https://github.com/nodejs/node/pull/62599
on Nov 6, 2026https://github.com/nodejs/node/issues/62503#event-35310728672
opensource-fork-synchttps://github.com/apps/opensource-fork-sync
on Nov 6, 2026https://github.com/nodejs/node/issues/62503#event-35311262405
dns: coalesce identical concurrent lookup() requestshttps://github.com/cla7aye15I4nd/opensource-nodejs__node/commit/ec4d4c2950d7c582e05901ad75726952605acd94
ec4d4c2https://github.com/cla7aye15I4nd/opensource-nodejs__node/commit/ec4d4c2950d7c582e05901ad75726952605acd94
aduh95https://github.com/aduh95
on Nov 11, 2026https://github.com/nodejs/node/issues/62503#event-35823426385
dns: coalesce identical concurrent lookup() requestshttps://github.com/nodejs/node/commit/2360d3860ef1805fb0922df87135abc69846f05c
2360d38https://github.com/nodejs/node/commit/2360d3860ef1805fb0922df87135abc69846f05c
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/62503
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/62503
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.