Expand description
SPEC_HOST_UI_THREAD_HANG_WATCHDOG_2026_08_14 §1–2 — capture evidence of a wedged host UI thread before anything (a person, usually) kills it.
On 2026-08-14 the host’s UI thread stopped pumping for ~16 minutes with a
window open; it was killed by hand and nothing had captured a stack, so the
deadlock’s cause is still unknown. A deadlock raises no exception, so the
crash handler path can’t see it — the dump has to be taken EXTERNALLY by
another process (what procdump -h does), here the launcher, which already
supervises the host and probes its UI thread (ui_liveness).
Detection + dump only. Automatically killing and respawning a wedged host (spec §1’s last step) is a separate decision and not done here.
Structs§
- Hang
Dump Latch - One dump per hang episode. Feed it
ui_liveness::consecutive_misses()after each probe tick; a reply resets the misses to 0, which re-arms it.
Constants§
- DUMP_
LOCK_ WAIT - How long a dump waits for another dump of this launcher to finish before it gives up. Under
srv_liveness::WEDGE_DUMP_BUDGET, so a wedged srv is still killed on time. - DUMP_
MAX_ AGE_ SECS - A dump older than this is deleted whenever a dump is written, even when fewer than the newest few are kept: a dump holds thread stacks, which can hold secrets that were in flight, so it is not kept for long. Age is read from the zero-padded seconds in the file’s name.
- HOST_
FILE_ 🔒PREFIX - File-name prefix of the host’s hang dumps.
- HOST_
HANG_ DUMP_ MISSES - Dump once the UI thread has missed this many consecutive liveness probes.
The probe runs every 60 s (
supervisor/windows.rs), so this is a UI thread silent for at least ~1–2 minutes. Two, not one: a laptop sleep can cost at most one miss (the first probe after resume is answered). - MAX_
DUMPS_ KEPT - Keep at most this many hang dumps; older ones are deleted.
- SRV_
WEDGE_ DUMPS_ KEPT - Srv wedge dumps kept per instance.
Statics§
- DUMP_
WRITER 🔒 - Held while a minidump is written.
MiniDumpWriteDumpis documented as unsafe to call from two threads of one process at once, and a host hang dump and a srv wedge dump can be asked for at the same time, so every writer in this module takes this first.
Functions§
- dump_
dir %LOCALAPPDATA%\CrashDumps\agentmux-host-hang\<instance_key>— kept apart from crash dumps (a hang dump and a crash dump mean different things to triage), and one folder per instance (instance_key= the launcher’s data-dir hash) so pruning never deletes another running instance’s evidence (ReAgent P2 on #3913).- dump_
dir_ under dump_dirwith an explicit base.Nonefor a key that isn’t a single plain path component — it is joined onto a path.- dump_
file_ name - Sortable by name: zero-padded timestamp first.
- dump_
file_ 🔒name_ with <prefix><zero-padded seconds>-pid<pid>.dmp; the prefix ends with-.- dump_
secs 🔒 - The seconds a dump’s name carries:
<prefix><zero-padded seconds>-pid<pid>.dmp. - plain_
component 🔒 - A key that is one plain path component: it is joined onto a path and put in a file name.
- prune_
old_ 🔒dumps_ at prune_old_dumps_withat a given time. A file with this prefix whose name carries no readable time is counted for the newestkeepand never deleted for its age.- prune_
old_ 🔒dumps_ with - Delete the dumps with
prefixindirthat are not among the newestkeepor are older thanDUMP_MAX_AGE_SECS. Best-effort. - srv_
wedge_ dir %LOCALAPPDATA%\CrashDumps\agentmux-srv-wedge\<instance_key>: where a wedged srv’s dump goes. It is the user’s own profile folder, which Windows scopes to that user (and the system and administrators), so another account on the machine cannot read it; a machine-wide folder such asC:\CrashDumpsis open to every local user, and a dump holds thread stacks that can hold secrets. One folder per instance, as for the host’s hang dumps.Nonewhen there is noLOCALAPPDATAor the key is not a single plain path component.- srv_
wedge_ dir_ under srv_wedge_dirwith an explicit base.- srv_
wedge_ prefix - File-name prefix of one instance’s srv wedge dumps (
agentmuxsrv-wedge-<instance_key>-), so pruning one instance’s dumps never deletes another running instance’s.Nonefor a key that is not a single plain path component. - with_
writer_ 🔒lock - Run
writeoncelockis free, waiting at mostwaitfor it. A dump that cannot get the lock in time is not written (Err): the caller carries on, and whoever holds it is writing a dump already. A lock a panicked writer left poisoned is taken all the same: it guards no data.