Skip to content

[Bug]: A hung desktop main process leaves no record and blocks macOS logout until force-quit #21301

Closed as not planned

Description

@josephv123

Note

Claude Opus 5.5 in Claude Code, writing on behalf of @josephv123. Measured on his machines on 2026-10-18.

Before submitting

Area

apps/desktop

Steps to reproduce

Not deterministic. Seen on a 16 GB Mac under critical memory pressure (28 GB swap) while ~12 agent threads ran test suites on the app's local server:

  1. The desktop main process stops making progress.
  2. Log out of macOS. Logout waits on T3 Code until you force-quit it.
  3. Afterwards, nothing in the app's logs records the hang.

Untested check for the missing record: kill -STOP main for 60 s, then kill -CONT; desktop.trace.ndjson should show only a gap.

Expected behavior

  • A stuck main process leaves a record: a stall entry, a stack or a crash dump.
  • Quitting or logging out finishes within a bounded time.

Actual behavior

Time (EDT) Event Source
13:44–13:49 Gaps of 120 s and 91 s with no main-process spans. Sync IPC calls that took ~0.25 ms earlier took up to 215 ms desktop.trace.ndjson
13:49:29 Last main-process span (a routine sync IPC call). The last telemetry sample was at 13:48:40 desktop logs
13:59:15 pid 61441 failed to act on a ping it dequeued before timing out WindowServer
14:00–14:39 App focused several times; no new spans or samples runningboardd
14:53:35 Logout adds the app to its quit list; the app never quits loginwindow
14:55:03, 14:55:07 Force quit, twice loginwindow
14:55:09 Killed: termination reported by launchd (2, 9, 9) runningboardd
  • There is no crash report, hang report or dump.
  • The embedded server process logged event-loop stalls of 54 s, 54 s and 420 s, the last ending at 14:16:43.
  • After the workload was stopped (~14:19), main stayed silent for 36 more minutes.

Root cause of the hang: unknown (no stack was captured). Unverified candidates:

What the code does. Line numbers are at the tag and match main @ 3adac94 unless noted.

Quit has no overall deadline:

  • before-quit is cancelled (app/DesktopLifecycle.ts:116), then requestDesktopShutdownAndWait (:84-94) waits on flushMainWindowBounds, a file-write join (window/DesktopWindow.ts:474-481; :489-496 on main), and on shutdown.awaitComplete.
  • Completion comes only after stopAllPoolInstances (app/DesktopApp.ts:341-351). Its 5 s timeout covers only closeRun: stop waits for the instance mutex untimed (backend/DesktopBackendManager.ts:1017), and the layer finalizer calls stop() with no timeout (:1121).
  • If the JS thread itself is blocked, none of this runs. The records can't say which case this was.

There are no hang or crash diagnostics:

  • Only render-process-gone is handled (window/DesktopWindow.ts:755; :777 on main).
  • There is no unresponsive listener and no crashReporter.
  • apps/desktop has no event-loop monitor (the server's apps/server/src/observability/EventLoopMonitor.ts produced the stall records above).

Suggested diagnostics:

  • Watchdog: a worker_thread that main heartbeats every second. After 10 s without a heartbeat it records the time, last span, event-loop delay and last heap/RSS, then runs /usr/bin/sample <mainPid> 5 -file … once. The resulting native and JS frames would tell the candidates apart.
  • Abort coverage: unresponsive logging plus a local-only crashReporter.
  • Quit deadline: about 10 s, then app.exit(), so logout cannot be blocked.

Impact

Major degradation or frequent failure

Version or commit

T3 Code (Nightly) 0.1.1-nightly.20261018.3315. The same code is on main @ 3adac94.

Environment

macOS 27.0.1 (26A434), MacBook Pro M5, 16 GB. The desktop app was connected to its local server and to two Linux servers over T3 Connect.

Logs or stack traces

2026-10-18 13:59:15.490 WindowServer: pid 61441 failed to act on a ping it dequeued before timing out.
2026-10-18 14:53:35.677 loginwindow: -[GUIApplicationLogout loadProccessesToQuitArray] | Adding: T3 Code (Nightly) to gui quit list
2026-10-18 14:55:03.015 loginwindow: T3 Code (Nightly) [61441] force quit (caller responsible for termination)
2026-10-18 14:55:09.070 runningboardd: [app<application.com.t3tools.t3code...>:61441] termination reported by launchd (2, 9, 9)

Workaround

Force quit. Before force-quitting, run sample <mainPid> 10 -file ~/Desktop/t3-main.txt to capture the stuck stack.

Activity

  1. juliusmarminge commented on Oct 18, 2026

    @juliusmarminge
    Member

    Note

    Grok responding on behalf of Julius.

    Closing this as a feature request rather than a bug. No stack was captured, so there is no root cause to act on. Your records point to the main thread being stuck well before logout: no spans after 13:49 and a WindowServer ping timeout at 13:59, under critical memory pressure. The memory pressure is tracked in #20329, main-process heap exhaustion in #21189 and #20395, and missing crash diagnostics in #10911.

    You are right that quit has no overall deadline on main. requestDesktopShutdownAndWait waits on the bounds flush and on shutdown.awaitComplete, and the 5 s pool timeout covers only closing the run. A deadline that runs on a stuck main thread would not fire in this case, though. A sample stack from a future hang would give us something concrete.

    Please bring the watchdog, unresponsive logging, crashReporter and quit deadline ideas to Ideas: https://github.com/pingdotgg/t3code/discussions/new?category=ideas

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequested improvement or new capability.via-triageFiled through npx t3 triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions