Repository navigation
libghostty: ghostty_surface_free deadlocks the app thread when the surface's reader is blocked pushing into the app mailbox #14234
Issue DescriptionFreeing a surface can deadlock the app thread forever. The wait chain at 683d8db (unchanged on d5eba8d):
In the original user's sample the blocked reader came through a CSI action ( A second shape of the same hang, seen in every single-surface run: the reader stall fills the 4-slot gather ring, the gather stage stops reading the pty, and Lines 1176 to 1214 in 683d8db killpg / waitpid(WNOHANG) / 10 ms sleep with no bound. ps shows the child's login wrapper in exit state with its own child a zombie or also exiting, and waitpid never returns it. I read that as the wrapper's exit blocking on tty output drain; the sample proves the loop and the full ring, not the kernel wait.
This is an embedding report: libghostty built from 683d8db, embedded in agterm (macOS, SwiftUI; https://github.com/umputun/agterm). A user hit it with 10 surfaces open (umputun/agterm#606), and it reproduces on demand with the recipe below, in the shipped agterm 0.28.0 and in a Debug build using the same pinned libghostty. Ghostty.app 1.3.1 and the tip build (d5eba8d) did not hang when the spamming command exited on its own and the surface closed on child exit; closing a still-producing Ghostty.app surface was not tested. Expected Behavior
Actual Behavior
Reproduction StepsTested host: agterm 0.28.0 (and a Debug build using the same pinned libghostty) on macOS 26.6.2, libghostty 683d8db. The close is agterm's
Control runs: on the 0.28.0 instance, with the spamming surface open and no close, the app thread answered 10 control requests over 10 seconds; on the Debug instance, closing one idle surface with eight idle surfaces open took 67 ms. Raw Ghostty LogsThat is the only Ghostty VersionOS Version InformationmacOS 26.6.2 (25G83), Apple Silicon Minimal Ghostty ConfigurationThe config agterm passes to libghostty in the reproduction ( theme = agterm
mouse-scroll-multiplier = 3
right-click-action = pasteAdditional Relevant ConfigurationDownstream report with the user's samples: umputun/agterm#606 AI usage disclosure: Claude Code and Codex, driven by me, did the offset symbolication (instruction-sequence matching against I acknowledge that:
|
Replies: 2 comments
|
I can reproduce on Linux/GTK with this script: #!/bin/sh
for i in 1 2 3 4; do
setsid timeout 60 bash -c 'while :; do printf "\033]0;t$RANDOM\007"; done' &
done
sleep 3run as |
#14245