ITADN

process.getActiveResourcesInfo() always returns [] (exists but empty) — silently defeats leak/shutdown checks

#36117Opensteipete 创建于 25 天前
S
steipetecommented
> [!NOTE] > **AI-generated issue.** Found, root-caused, and written up by an AI agent (Claude) while running OpenClaw's test suite under Bun, on behalf of and reviewed by @steipete. ### What version of Bun is running? `1.4.0-canary.1+6c12afd8e` (Rust rewrite, current main) ### What platform is your computer? Darwin 27.0.0 arm64 (Apple Silicon macOS) ### What steps can reproduce the bug? ```js const t = setTimeout(() => {}, 9999); const i = setInterval(() => {}, 9999); console.log(process.getActiveResourcesInfo()); clearTimeout(t); clearInterval(i); ``` ### What is the expected behavior? Node returns the live handle/request kinds, e.g. `[ 'Timeout', 'Timeout', ... ]` — a `setTimeout` and `setInterval` each show up as an active `Timeout`. ### What do you see instead? Bun prints `[]`. `process.getActiveResourcesInfo` **exists and is callable**, but it always returns an empty array regardless of active timers, sockets, or other handles. ### Additional information - This is distinct from #24538, which reports the method as *missing* (and manifests as a hung process). Here the method is present, so `typeof process.getActiveResourcesInfo === "function"` guards pass — the failure is silent: any code that inspects the result (leak detectors, graceful-shutdown drains, "is anything still keeping the loop alive?" checks) concludes nothing is active and behaves incorrectly. A silent empty result is more dangerous than a missing method because it defeats feature detection. - Minimal expectation: the method should reflect at least timers and interval handles created via `setTimeout`/`setInterval`, matching Node's documented behavior. - Found because OpenClaw's gateway restart-trace test asserts `activeTimersCount >= 1` after arming a timer; under Bun the count is always 0.
2 条评论