GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — dns.lookup: pending promises grow unboundedly under sustained EAI_AGAIN load · Issue #62503 · nodejs/node Closed Closed Copy link DescriptionVersionv24.14.1 PlatformSubsystemdns What steps will reproduce the bug?When In 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 Minimal reproduction — save as import { lookup } from 'node:dns/promises'; const HOSTNAME = 'asd'; // triggers EAI_AGAIN const INTERVAL_MS = 2000; const TOTAL = 50; let pending = 0; let started = 0; let settled = 0; function fire() { const id = ++started; ++pending; const t0 = Date.now(); console.log(`[#${id}] started (pending: ${pending})`); lookup(HOSTNAME).then( (result) => { --pending; ++settled; console.log(`[#${id}] resolved ${result.address} after ${Date.now() - t0}ms (pending: ${pending})`); }, (err) => { --pending; ++settled; console.log(`[#${id}] rejected ${err.code} after ${Date.now() - t0}ms (pending: ${pending})`); } ); } const interval = setInterval(() => { if (started >= TOTAL) { clearInterval(interval); return; } fire(); }, INTERVAL_MS); setInterval(() => { console.log(`\n--- status: started=${started} settled=${settled} pending=${pending} ---\n`); }, 5000).unref(); setTimeout(() => { console.log(`\n=== FINAL: started=${started} settled=${settled} stuck=${pending} ===`); if (pending > 0) console.log(`LEAK CONFIRMED: ${pending} lookup(s) never settled.`); else console.log('No leak detected.'); process.exit(pending > 0 ? 1 : 0); }, TOTAL * INTERVAL_MS + 60_000); Run: How often does it reproduce? Is there a required condition?Always What is the expected behavior? Why is that the expected behavior?Each What do you see instead?
Sample output (trimmed): The 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. Additional information
Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |