Skip to content

fix: use NonBlockingCall in ThreadedAsyncOperation to prevent SIGBUS on macOS#21624

Merged
ludamad merged 1 commit into
backport-to-v4-stagingfrom
fix/threaded-async-op-sigbus-v4
Mar 16, 2026
Merged

fix: use NonBlockingCall in ThreadedAsyncOperation to prevent SIGBUS on macOS#21624
ludamad merged 1 commit into
backport-to-v4-stagingfrom
fix/threaded-async-op-sigbus-v4

Conversation

@ludamad

@ludamad ludamad commented Mar 16, 2026

Copy link
Copy Markdown
Collaborator

Fixes SIGBUS crash on macOS in ThreadedAsyncOperation (#21138).

delete op was inside the BlockingCall callback, destroying the object while BlockingCall was still unwinding on the worker thread. macOS unmaps freed pages aggressively → SIGBUS. Linux keeps them mapped → silent use-after-free.

Fix: move delete this to after BlockingCall returns on the worker thread.

Full post mortem with diagrams

The JS callback destroyed `this` while BlockingCall was still on the worker
thread's call stack. On macOS, the freed page is unmapped immediately → SIGBUS.
Move `delete this` to after BlockingCall returns on the worker thread.
@ludamad ludamad force-pushed the fix/threaded-async-op-sigbus-v4 branch from c65b053 to 3b195dc Compare March 16, 2026 18:11
@ludamad ludamad enabled auto-merge (squash) March 16, 2026 18:16

@alexghr alexghr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@ludamad ludamad merged commit ec607c2 into backport-to-v4-staging Mar 16, 2026
11 checks passed
@ludamad ludamad deleted the fix/threaded-async-op-sigbus-v4 branch March 16, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-barretenberg Run all barretenberg/cpp checks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants