Skip to content

Windows: backend segfaults in embedded @parcel/watcher (2.5.1), killing all in-flight sessions #56236

Closed as duplicate

Description

@mradwankhalil

On Windows the v2 server (2.0.29, Bun 1.4.2) crashed after ~18.7 h uptime:

panic(thread 71472): Segmentation fault at address 0xFD8
oh no: Bun has crashed. This indicates a bug in Bun, not your code.
RSS: 2.15 GB | Peak: 2.78 GB

Every crash frame is in the embedded native addon built from parcel-bundler/watcher (watcher.pdb, binding.cc, ReadDirectoryChangesW), on a non-main thread. The desktop host restarted the server (periodic-process-exited, exitCode 3) — and every running session's turn was lost (6 busy sessions at the time). This is the first crash of its kind in ~5 weeks of logs (since 2026-09-10).

This matches parcel-bundler/watcher#262 — a Windows use-after-free where unsubscribe() destroys the Subscription while a ReadDirectoryChangesW completion APC is still pending. OpenCode unsubscribes frequently (location idle eviction, config/skill watch reconciliation), which widens the window.

Ask:

  1. Track gemini "i'm finished" loop #262 and bump @parcel/watcher once it is fixed.
  2. Interim consideration: on Windows, avoid unsubscribe→resubscribe cycles of the same path — reuse the subscription and filter in JS.

Not the reload path: separately verified on the same build (controlled repro, mock LLM, config writes mid-turn) that in-flight turns survive config reloads (agent edit + plugin-generation change) and pick up the new config on their next turn — only the process crash interrupts turns.

Activity

  1. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for the careful write-up. Tracing the crash to parcel-bundler/watcher#262 is especially useful.

    I think this is a duplicate of #47505. That issue is the same crash: on Windows, the embedded Bun 1.4.2 panics inside the bundled @parcel/watcher addon while watch subscriptions are being stopped and restarted. The server exits with code 3, gets restarted, and the active sessions are lost. What triggers the churn varies between reports (bulk skill writes, config reloads, and here idle eviction and watch reconciliation), but the crash is the same.

    Possible duplicates and related issues, ordered from most to least likely:

    It would help to post your upstream analysis (parcel-bundler/watcher#262) and your two suggestions (update @parcel/watcher once #262 is fixed; on Windows, reuse the subscription for a path instead of unsubscribing and resubscribing) on #47505, so everything is in one place. Until this is fixed, setting OPENCODE_DISABLE_FILEWATCHER=1 avoids the crash, but OpenCode will then no longer notice file changes on its own.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. mradwankhalil commented on Oct 16, 2026

    @mradwankhalil
    ContributorAuthor

    Thanks — the duplicate analysis is convincing and the related list is helpful. Two additions from our side (both going up on #47505 as you suggested):

    1. We verified with a controlled repro (same 2.0.29 build, mock LLM, config writes mid-turn) that in-flight turns survive config reloads and pick up the new config on their next turn — so in our case the trigger was not the reload path. The crash came from the watcher addon while the backend had been up ~18.7 h (RSS 2.15 GB, peak 2.78 GB) — possibly overlapping serve: Bun 1.4.2 segfault (address 0x3D8) after long uptime on Windows #53688's long-uptime angle.
    2. Our crash frames + the Windows: use-after-free — unsubscribe() destroys Subscription while a ReadDirectoryChangesW completion APC is still pending parcel-bundler/watcher#262 mapping + the two suggestions (bump once fixed; reuse subscriptions on Windows instead of unsubscribe→resubscribe) are posted on core: global skill update terminates shared service on Windows #47505.

    No objection to closing this as a duplicate — we'll track #47505.

  3. opencode-agent commented on Oct 16, 2026

    @opencode-agent
    Contributor

    Thanks for confirming, and for moving the crash frames, the parcel-bundler/watcher#262 mapping and both suggestions to #47505. That keeps everything in one place.

    Thanks also for checking that in-flight turns survive config reloads. That rules out the reload path as the trigger in your case. The long uptime and high RSS (~18.7 h, 2.15 GB) may well connect to #53688, so it could help to mention that on #47505 too, if you haven't already.

    The bot will close this issue as a duplicate of #47505 as planned. Please follow that issue for updates.

  4. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #47505, as you agreed. Thanks for posting the crash frames, the parcel-bundler/watcher#262 mapping and your two suggestions there. Updates on the Windows @parcel/watcher crash will be on #47505; #53688 tracks the long-uptime Bun segfault. If this turns out to be a different problem, reply here and we'll take another look.

  5. mradwankhalil commented on Oct 23, 2026

    @mradwankhalil
    ContributorAuthor

    Thanks for consolidating the crash report. Understood that #47505 is the Windows watcher tracking issue and #53688 is the related long-uptime Bun crash report; this issue remains a duplicate, not evidence of a separate newly reproduced defect.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions