Repository navigation
Intermittent SIGABRT in terminal.search.Thread.test_0 on macOS via libxev kqueue race #14719
Unanswered
KooshaPari
asked this question in
Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
Test
terminal.search.Thread.test_0intermittently SIGABRTs on macOS / Zig 0.16.0_1 / xev kqueue backend. When the search thread is stopped viaxev.Async.notify()followed bystd.Thread.join(), a race between the search thread'sloop.run(.once)and the test thread'sloop.deinit()causeskevent()to be called on an already-closed kqueue FD. libxev'skqueue.zig:1916then fires.BADF => unreachable(the comment "Always a race condition" at that line is correct).Why I'm filing here
I don't have
CreateIssuepermission onghostty-org/ghostty(no org membership), so this lands in Issue Triage as a starting point. Happy to convert to a proper issue or PR if a maintainer wants to take it.Crash signature
Precursor warnings (preceding the crash)
The page allocator is being corrupted during teardown before the FD race fires.
Repro
--test-filter terminal.search.Thread.test_0and full-suite 25-iteration loops.The race is latent; memory and threading pressure is what surfaces it.
Suggested fix
Either:
self.loop.run(.once)inThread.zig::threadMain_(Thread.zig:197and:211) withif (!self.loop.stopped())so a stop notification that races with the search thread'sloop.rundoesn't trigger a kevent on a closing FD.kqueue.zig:1916— the.BADF => unreachableshould re-arm the loop or exit cleanly when the loop is being torn down, since the comment "Always a race condition" is already admitting this is a known foot-gun, not an actual programmer error.Environment
zig-pkg/libxev-.../)All reactions