Skip to content

Backport Ghostty opener-stderr fix (3b8141f): stop the CPU-pinning log loop - #1015

Merged
scgopi merged 1 commit into
mainfrom
fix/1014-ghostty-opener-stderr
Nov 18, 2026
Merged

scgopi merged 1 commit into
mainfrom
fix/1014-ghostty-opener-stderr

Conversation

@scgopi

@scgopi scgopi commented Nov 18, 2026

Copy link
Copy Markdown
Owner

Fixes #1014.

Ghostty's os/open.zig drains the URL/file opener's stderr with takeDelimiterExclusive('\n'), which never consumes the \n. Once the opener writes one line, for example after an OSC 8 link with an unknown scheme, every later read returns an empty slice. The detached thread spins forever: it pins a core, floods the unified log with os-open: open stderr=, and never reaps the child. Each link opened adds another stuck thread.

Change

  • ThirdParty/ghostty now points at scgopi/ghostty branch graphcode-patches (ff98ec4), which is the old pin 30e1f3bb plus upstream 3b8141fbd8e2 and nothing else. It switches to takeDelimiterInclusive and trims the \n before logging.
  • .gitmodules URL moves to the fork, with a comment like the one on the zmx entry. Drop the fork once the pin moves past 3b8141f.

I picked this over bumping the pin because upstream is 1033 commits ahead, with unrelated Zig API migrations (std.Io).

Evidence

I tested a standalone Zig 0.15.2 copy of openThread's loop. It drains a child that writes two stderr lines, capped at 1000 iterations.

RED: zig test repro.zig, exclusive variant -> loop hits the 1000-iteration cap (spins without advancing)
GREEN: zig test repro.zig, inclusive variant -> exactly 2 lines read, EndOfStream, child reaped
REGRESSION: zig ast-check ThirdParty/ghostty/src/os/open.zig -> ok; takeDelimiterInclusive and std.mem.trimEnd both exist in the pinned zig 0.15.2 std

Pin ThirdParty/ghostty to scgopi/ghostty graphcode-patches (ff98ec4), which
is the current pin 30e1f3bb plus upstream 3b8141fbd8e2. Without it, an
opener that writes a line to stderr leaves openThread spinning on an empty
slice forever, one pinned core and a log flood per link opened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: scgopi <scgopireddy@gmail.com>
@scgopi
scgopi merged commit 3d21023 into main Nov 18, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CPU hogging issue

1 participant