Skip to content

[Bug]: Desktop crash (EXC_BREAKPOINT/SIGTRAP) in watcher.node Watcher::isIgnored via FSEvents — Orca 1.4.137 macOS #8479

Closed

Description

@Divkix

Operating system: macOS 26.5.2 (25F84), Apple Silicon (Mac15,7)
Orca version: 1.4.137 (com.stablyai.orca)
Bundled watcher: @parcel/watcher 2.5.6 (@parcel/watcher-darwin-arm64)

Short summary

Desktop Orca just hard-crashed the whole app while I had an orchestrator running. Full process kill, not a recoverable JS error. Faulting thread is inside the bundled native file watcher on the FSEvents path:

FSEventsCallback → Watcher::isIgnored → v8::String::MakeExternal → EXC_BREAKPOINT (SIGTRAP)

This looks like the same general crash class as #5377 / #7547 / #8212 (native @parcel/watcher taking down the process), but the stack is different from those. Closest open sibling is probably #6635 on Linux serve, which is still a N-API / watcher-area abort.

I searched for Watcher::isIgnored / MakeExternal / 1.4.137 and did not find an open issue with this exact frame, so filing a fresh one.

What happened

App had been up for a long session (launched ~09:59, crashed ~23:43 local). I was working a monorepo worktree (vinext / soapfish-style, lots of agent/file churn). The orchestrator failed and the whole Orca window disappeared. macOS crash report points at Thread 47, not the main UI thread.

From the report:

Exception Type:    EXC_BREAKPOINT (SIGTRAP)
Exception Codes:   0x0000000000000001, 0x0000000115445224
Termination Reason: Namespace SIGNAL, Code 5, Trace/BPT trap: 5
Triggered by Thread: 47

Crashed thread:

Thread 47 Crashed:
0   Electron Framework    ares_dns_rr_get_ttl + 3155384   (brk 0 / N-API fatal-ish abort)
1   Electron Framework    ...
2   Electron Framework    v8::internal::ThreadIsolation::JitPageReference::AllocationContaining...
3   Electron Framework    uv_handle_set_data + ...
4   Electron Framework    ...
5   Electron Framework    v8::String::MakeExternal(v8::String::ExternalStringResource*)
6   watcher.node          Watcher::isIgnored(std::string) + 1060
7   watcher.node          FSEventsCallback(...) + 608
8   FSEvents              implementation_callback_rpc
...
18  watcher.node          FSEventsBackend::start()

There's also a separate watcher debounce thread idle at the time:

Thread 46:
  Debounce::loop()   (watcher.node)

Binary path for the native module in the crash:

/Applications/Orca.app/Contents/Resources/node_modules/@parcel/watcher-darwin-arm64/watcher.node

Notes from the installed build

I peeked at the bundle after the crash:

  • @parcel/watcher and @parcel/watcher-darwin-arm64 are both 2.5.6
  • There is a parcel-watcher-process-entry.js child-process helper with a canary restart (process.exit(2) if events stop delivering)
  • Despite that isolation, this crash still took down the main Orca process with watcher.node loaded in-process on the FSEvents callback path

So even if the out-of-process watcher is supposed to own native subscriptions, something is still ending up calling into Watcher::isIgnored from the FSEvents thread in a way that can abort Electron/V8.

Related issues

If #5377 is considered fixed for the findCallback path, this looks like a remaining (or regressed) variant on the FSEvents ignore path.

How to reproduce

Not a hard repro yet. In my case:

  1. Open Orca desktop 1.4.137 on macOS Apple Silicon
  2. Work in a large monorepo with active agents / orchestrator
  3. Leave it running for a long session with normal git + agent filesystem churn
  4. Eventually the app just dies; crash report shows Watcher::isIgnored on the FSEvents thread

Happy to grab more logs or try a debug build if useful. Full macOS Translated Report available if someone wants the complete dump.

Activity

  1. Jinwoo-H commented on Jul 15, 2026

    @Jinwoo-H
    Contributor

    Thanks for the detailed report — the crash report pointers made this one tractable. We dug into this and can explain what happened.

    Root cause

    This is a native lifetime defect in @parcel/watcher 2.5.6: its process-global shared state (the watcher registry, shared FSEvents backend, and directory tree) holds per-environment N-API references without lifetime guards. When a Node environment that subscribed goes away while the shared backend is live, the FSEvents callback thread and subscribe/teardown paths can touch freed or stale state.

    We reproduced this deterministically against the exact bundled watcher.node (2.5.6, darwin-arm64) — no mocks, real addon:

    • Minimal trigger: a worker_threads worker calls subscribe() (FSEvents backend) and exits without unsubscribing; the next subscribe() from another thread crashes the process. 20/20 runs, ~350ms to crash, under both Node and Electron.
    • The crash surfaces at several sibling frames depending on which thread loses the race: Watcher::findCallback/napi_strict_equals, Watcher::triggerCallbacks → dead threadsafe-function abort, FSEventsCallback → DirTree::remove UAF — and SIGTRAP/EXC_BREAKPOINT like yours. Your FSEventsCallback → Watcher::isIgnored frame is the same family: the FSEvents callback thread reading watcher state that another environment's teardown freed.

    Why it hit you on 1.4.137, and why the helper didn't save you

    You correctly spotted parcel-watcher-process-entry.js in your bundle — in 1.4.137 that isolation covered the explorer watches, but the runtime file watches still ran on worker_threads inside the main process and imported @parcel/watcher directly. Native addon state is process-wide, so those worker subscriptions shared one FSEvents backend with the main process; a worker teardown race could (and did) take down the whole app. Long sessions with heavy agent/worktree churn — exactly your setup — maximize those teardown/resubscribe cycles.

    This was fixed in v1.4.138 (#8370): runtime file watches were moved out of the main process into crash-contained forked watcher processes. We validated the containment on the current build, including real native watcher crashes on macOS being absorbed by the child process with automatic resubscribe — the app survives.

    What to do

    Please upgrade to v1.4.138 or later (current is v1.4.139). We're closing this as fixed by that containment; if you ever see a crash on ≥1.4.138 where the main Orca process dies with watcher.node on the faulting thread, please reopen with the crash report — we'd want to see it immediately.

    Two follow-ups we're tracking separately: reporting the underlying lifetime defect upstream with our minimal repro, and hardening one remaining narrow in-process subscription (a small per-repo .git/worktrees watch) as defense-in-depth.

  2. bbingz commented on Jul 16, 2026

    @bbingz
    Contributor

    Reproduced again on Orca 1.4.143 (macOS 27.0 / build 26A5378n, Apple Silicon), so the v1.4.138 containment did not fully close this crash path.

    At 2026-07-16 10:49 UTC+8, the desktop main process died during normal linked-worktree use. This was not a user quit, external signal, or OOM. Sanitized crash evidence:

    • EXC_BREAKPOINT (SIGTRAP), termination signal 5, deliberate brk #0
    • @parcel/watcher 2.5.6 (watcher.node)
    • Watcher::isIgnored(std::string) + 1060
    • FSEventsCallback(...) + 608
    • Electron image offset 0x540d224
    • Chromium PartitionAlloc detected freelist corruption while operator delete was freeing a heap-backed temporary string; the recorded slot size was 480 bytes

    This matches the original #8479 report at both the watcher-symbol and Electron image-offset levels.

    The remaining containment gap appears to be the narrow macOS Git-common watch. In v1.4.143, worktree-git-common-watch.ts still imports @parcel/watcher directly and subscribes to the Git common directory's worktrees subtree in the Electron main process, bypassing the forked watcher supervisor. This is the remaining narrow in-process subscription mentioned in the closing comment. The explorer/runtime watcher paths are isolated, but a native failure in this path can still load watcher.node into Electron main and terminate the entire GUI.

    Normal Git status churn was present immediately before the crash and can produce FSEvents beneath the watched Git worktree-metadata directory. That is a plausible trigger, not proof of the first corrupting write: the allocator detected the corruption later during cleanup inside isIgnored, so the report alone cannot distinguish a use-after-free, double free, or adjacent overflow.

    Please reopen this as a regression on a version newer than 1.4.138. The containment fix would be to route the macOS Git-common narrow watch through the existing forked watcher supervisor (or use a polling fallback), with a linked-worktree metadata-churn fault-containment regression test.

    I can provide a further-sanitized full .ips report if useful.

  3. bbingz commented on Jul 16, 2026

    @bbingz
    Contributor

    Sanitized full crash report for the Orca 1.4.143 recurrence:

    Redacted: unique device, user, process, session, incident, and local-workspace identifiers. Retained for symbolication: all thread stacks, the faulting thread's registers, instruction bytes, binary image UUIDs/addresses, and system/app/Electron versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions