Bun Timer Drain Spins at 100% CPU After Invalid CLOCK_MONOTONIC Reading
Is it fixed? Not yet.
Ongoing since Nov 14, 22:30 UTC. First reported Nov 14, 22:30 UTC.
What happened
Bun versions 1.4.4 and later experience a 100% CPU usage loop and ignore SIGTERM when an erroneous CLOCK_MONOTONIC reading causes the drain_timers function to continuously re-fire timers without yielding. Linux users running affected versions are impacted by the infinite loop.
What caused it?
The drain_timers function reads CLOCK_MONOTONIC once, caches it, and enters an unlimited loop firing any timer due at that cached time. If the clock reading is artificially high, recurring timers with short setTimeouts cause the drain loop to never return.
No verified workaround yet
None of the linked reports describe a mitigation. This page updates when one appears.
Official fixTimeline
- Investigating(current)
- Workaround available(upcoming)
- Resolved(upcoming)
- First report on GitHub issue
Timer drain spins at 100% CPU for X seconds, without polling, after one CLOCK_MONOTONIC reading that is X seconds too high; SIGTERM ignored
Source
Evidence
2 reports · 2 GitHubShow
- [1]GitHub First reportTimer drain spins at 100% CPU for X seconds, without polling, after one CLOCK_MONOTONIC reading that is X seconds too high; SIGTERM ignored(opens GitHub issue in a new tab)
What version of Bun is running? 1.4.4+38afee6c8 What platform is your computer? Linux 6.18.55-1-MANJARO x86_64 unknown What steps can reproduce the bug? The bug in short. drain_timers reads CLOCK_MONOTONIC once, caches it, and fires every timer that is due at that cached time, in a loop without a limit. If that one reading is X seconds too high, a timer whose callback starts the next timer with setTimeout, with a delay below X, is due again at once, every time. The drain then does not return…
by trptr 0upvotes 1comments
- [2]GitHubTimers starve for ~40 s when Bun.serve has >1024 ready sockets under CPU saturation (drain_ready_polls loops 48× per tick)(opens GitHub issue in a new tab)
What version of Bun is running? 1.4.4 (latest release). The code below is unchanged on main. What platform is your computer? Linux 7.0.0 x86_64 (epoll). I haven't tested kqueue, but it shares the drain loop. What steps can reproduce the bug? A Bun.serve whose handler does ~0.8 ms of sync work, with more than 1024 concurrent keep-alive connections, so the process is CPU-bound and every epoll_pwait2 returns a full batch. A setInterval(…, 20) in the same process stops firing for about 40 s at a…
by nolnoch 0upvotes 1comments92% match
FAQ
What happened in the Bun issue?
Bun versions 1.4.4 and later experience a 100% CPU usage loop and ignore SIGTERM when an erroneous CLOCK_MONOTONIC reading causes the drain_timers function to continuously re-fire timers without yielding. Linux users running affected versions are impacted by the infinite loop.
What is affected by the Bun issue?
Bun (versions: 1.4.4+38afee6c8). Also affected at the same time: Linux.
When did the Bun issue start and end?
It started Nov 14, 22:30 UTC and is still ongoing (4 d 6 h so far). This page updates as it develops.
How do I get alerts for Bun?
Subscribe to the Bun RSS feed for every new Bun incident, or connect an AI assistant to WhatBrokeToday over MCP and ask whether Bun is down. Bun feed
Where does this information come from?
WhatBrokeToday collects public status pages, developer community reports and security advisories, groups the ones about the same problem, and links every report under Evidence on this page. This one has 2 reports from 1 independent source.