#7692·wezterm

mux-server can stay alive but stop answering `wezterm cli` / SSH proxy attach under load

Author: joyshmitzCreated Mar 26, 2026Updated Sep 21, 2026

Summary

I hit a mux-server failure mode on WezTerm release 20240203-110809-5046fc22 (5046fc225992db6ba2ef8812743fadfdfe4b184a, published 2024-02-03) where the process stayed alive, memory stayed healthy, but the control plane effectively stopped answering:

  • local wezterm cli list --format json timed out on the host itself
  • local wezterm cli list-clients timed out on the host itself
  • new SSH-domain attaches hung at Checking server version
  • restarting the mux owner process immediately restored normal behavior

This was not an OOM and did not look like an SSH/auth problem. SSH auth was still succeeding. The mux process was still present. The host had plenty of free memory.

Why this looks like mux-server starvation / backlog rather than a dead process

During the incident, the mux server log showed a long stream of:

  • reading Pdu from client: decoding a PDU: reading PDU length: Connection reset by peer

and later a burst of:

  • writing pdu data buffer: Broken pipe

That pattern is consistent with clients timing out and disconnecting first, and the server only later trying to flush responses/notifications into sockets that were already gone.

Code path in the exact release that seems relevant

I checked the exact source for tag 20240203-110809-5046fc22, not current main, and the relevant structure in that release looks like this:

  • wezterm-mux-server-impl/src/dispatch.rs
    • each connection subscribes to mux notifications immediately
    • per-connection work is funneled through smol::channel::unbounded::<Item>()
    • every MuxNotification::PaneOutput triggers handler.schedule_pane_push(...)
  • wezterm-mux-server-impl/src/sessionhandler.rs
    • schedule_pane_push() dispatches a detached spawn_into_main_thread(...)
    • ListPanes and GetLines also go through spawn_into_main_thread(...)
  • promise/src/spawn.rs
    • SimpleExecutor is a single unbounded queue feeding main-thread jobs

So in the 2024-02-03 release itself, control-plane requests and render/update pushes are sharing the same single-thread scheduler, and the notification side is unbounded.

Grounded hypothesis

Under sustained PaneOutput activity, render/update jobs can backlog enough to starve early control-plane requests such as:

  • GetCodecVersion
  • SetClientId
  • ListPanes

That would explain why a brand-new SSH proxy attach can hang at Checking server version even though the mux process is still alive.

Why I think this is distinct from other known issues

I am not talking about:

  • client disconnect noise from normal shutdown
  • a host OOM event
  • a shell startup / stdout corruption issue

This was a live mux process that remained present but stopped servicing wezterm cli requests in a timely way.

I also noticed a later upstream commit, 100b85d (Remove mux-server race condition.), but I am not claiming that fixes this specific hang. I mention it only because it touches nearby mux-server render/update logic.

Rough reproduction shape

I do not have a tiny standalone reproducer yet, but the behavior occurred in this shape:

  1. Linux host running a live mux with several panes producing steady output.
  2. Additional automation repeatedly querying pane state via wezterm cli.
  3. New SSH-domain attach attempted from another client.
  4. New attach hangs at Checking server version.
  5. Local wezterm cli list on the host also times out.
  6. Mux process remains alive until manually restarted.

Requests / possible directions

  1. Confirm whether eager subscription to all mux notifications before handshake is intentional for short-lived control-plane clients.
  2. Consider bounding or coalescing per-connection notification queues.
  3. Consider prioritizing request/response PDUs over PaneOutput-driven render pushes.
  4. Consider delaying subscription until after successful client registration / initial attach handshake.

Acceptance criteria

A live wezterm-mux-server under output-heavy load should not be able to enter a state where:

  • the process remains alive
  • local wezterm cli list times out repeatedly
  • new SSH-domain attaches hang at Checking server version
  • recovery requires restarting the mux owner process