Changelog

oven-sh/bun · · 8 commits

Cron callbacks, socket fixes, and Linux stats

Bun adds in-process cron jobs, fixes Unix socket cleanup/semantics, and widens Linux statx fallbacks for seccomp and other edge cases.

In-process Bun.cron lands with new scheduling API (aliicf11b7d)

Bun now supports Bun.cron(schedule, handler) for running callbacks inside the current process, alongside the existing OS-level cron job registration and cron parsing APIs. The new handle supports stop/unref-style lifecycle control, and the docs clarify UTC vs local-time behavior across the two cron modes.

Linux statx fallback now matches libuv’s edge cases (robobun9053830)

fs.stat/lstat/fstat on Linux now fall back not just for ENOSYS and EOPNOTSUPP, but also for EPERM, EINVAL, and positive non-zero statx return codes. This fixes seccomp-filtered environments and other platforms where statx is unavailable in practice but didn’t previously trigger Bun’s fallback path.

Unix socket lifecycle now matches Node/libuv (Jarred-Sumner3f41407)

Bun no longer silently unlinks an existing Unix socket path before binding, which means it won’t steal a live socket from another process. It also now removes the socket file on close/finalize, fixing stale .sock file leaks and bringing behavior in line with Node.js expectations.

MacOS long Unix socket paths get a new workaround (Jarred-Sumner159a285)

bun-usockets now handles macOS Unix socket paths that exceed sun_path by opening the parent directory and using __pthread_fchdir() to bind/connect via a relative basename. This mirrors Bun’s Linux path workaround and extends Unix socket support to longer paths on Apple platforms.

Event loop drains saturated ready-poll batches (Jarred-Sumnerea83a74)

When epoll/kqueue fills the full ready-polls buffer, Bun now re-polls and dispatches additional events before running callbacks, up to a capped drain loop. This reduces latency and prevents large bursts of ready FDs from being processed one 1024-event slice at a time.

Other misc changes

  • FreeBSD Linuxulator /dev/fd fallback for getFdPath and realpath regression coverage (ant-kurta440dff)
  • Cgroup-aware availableParallelism / hardwareConcurrency work on Linux (Jarred-Sumner85f073f)
  • WebView test flake cleanup and using-style resource cleanup updates (Jarred-Sumner2f6f266)