[Bug 298878] linux(4): epoll_pwait(2)/epoll_pwait2(2) with a sigmask leave a stale signal mask, deadlocking Bun apps (Claude Code, opencode)

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 28 Sep 2026 14:21:14 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298878

Yuki Tachi <yuki.tachi@donut-service.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yuki.tachi@donut-service.co
                   |                            |m

--- Comment #7 from Yuki Tachi <yuki.tachi@donut-service.com> ---
Confirming the fix on arm64 as well.

Setup: FreeBSD 15.1-RELEASE-p2 arm64 (GENERIC), linux_base-rl9-9.7,
Claude Code native Linux binary (Bun).

Before: Claude Code 2.1.283 froze within 0-90 s every time; ktrace/procstat
showed the same state as described here (main thread in futex, signal 98
pending+blocked). Details:
https://github.com/anthropics/claude-code/issues/96931

Patch: applied commit 16a284b1cdfd to releng/15.1, rebuilt linux64.ko
(with KERNBUILDDIR from the GENERIC config) and replaced the module.

After:
- Independent reproducer (static aarch64 glibc binary, attached) now matches
Linux:
  A: epoll_pwait=-1 errno=Interrupted system call after 200 ms, handler ran 1,
SIGUSR1 blocked after: yes
  B: epoll_pwait=0, SIGUSR2 (marker) blocked after: no
  (stock module: A returned 0 and left SIGUSR1 unblocked; B left SIGUSR2
blocked)
- Claude Code 2.1.283 has run for over an hour of normal interactive use
without freezing.

Thanks for the analysis and the quick fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.