Skip to content

wrangler dev workerd exits on EPIPE while writing captured stdout #15202

Description

@adityak6798

What happened

wrangler dev starts workerd successfully and serves requests for several minutes. When its stdout is captured by Playwright webServer, workerd can exit partway through the suite while writing request logs:

✘ [ERROR] kj::getCaughtExceptionAsKj() = kj/async-io-unix.c++:186:
          disconnected: ::write(fd, buffer.begin(), buffer.size()): Broken pipe

Wrangler then exits and every later request fails with ECONNREFUSED. In one run this produced 31 misleading browser assertion/time-out failures. The application log contained no request.exception entries; the runtime failed while writing its own log stream, not while serving product code.

We have observed six non-deterministic sightings across macOS and GitHub-hosted Linux runs. Re-running the same commit can fail different, disjoint specs. Representative hosted runs:

Configuration

  • Wrangler 4.x (4.123.0 currently installed; the repository lockfile governs hosted runs)
  • Playwright webServer launches npm run dev --workspace @greenroom/api
  • request logs are JSON lines written to stdout/stderr
  • one Playwright worker, local D1

Workaround

We now launch Wrangler under a small supervisor whose stdout/stderr are file descriptors for a checkout-local durable log rather than Playwright capture. Product request logging remains enabled. We also probe /health around every test so a runtime loss is reported once and later journeys are skipped.

Expected behavior

Closing or losing the stdout consumer should not terminate the Worker runtime. Wrangler/workerd should either keep serving with logging disabled for that sink, reopen/redirect the sink, or exit with one clear supervisor-level diagnostic that identifies stdout EPIPE rather than leaving consumers with unrelated request failures.

I can provide a fuller apps/api/.wrangler/wrangler.log excerpt if useful; it includes the kj message and stripped workerd frames but may contain application request metadata, so it is not pasted wholesale here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    package:wranglerRelating to the `wrangler` package

    Type

    No type

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions