Report search-related terminal close freezes#3999
Conversation
|
@miracle2k is attempting to deploy a commit to the Manaflow Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThis PR adds a new documentation page analyzing a reproducible macOS cmux freeze that occurs during Ghostty terminal surface teardown when terminal search is active. The report includes an observed stack trace, a suspected deadlock hypothesis involving search-thread callbacks and mailbox blocking, a reference to a proposed Ghostty fix, and local validation steps. ChangesSearch Shutdown Freeze Analysis
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error)
✅ Passed checks (14 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR adds a documentation file (
Confidence Score: 5/5This PR is safe to merge — it adds only a documentation file with no production code changes. The change is a single new markdown document. It makes no modifications to Swift source, runtime behavior, build configuration, or any executable path. The document is clearly written, honestly discloses its AI-assisted provenance, and accurately points the actual fix to an external PR for proper review. No files require special attention; the only change is a new documentation file. Important Files Changed
Sequence DiagramsequenceDiagram
participant AppThread as App/Main Thread
participant SearchThread as Ghostty Search Thread
participant Mailbox as Renderer/App Mailbox
AppThread->>AppThread: Close/free terminal surface
AppThread->>SearchThread: Signal stop (Surface.deinit)
AppThread->>AppThread: pthread_join (WAITING)
Note over AppThread: blocked here
SearchThread->>SearchThread: Emit final UI callbacks
SearchThread->>Mailbox: Enqueue renderer/app messages
Note over Mailbox: Mailbox full, indefinite wait
Mailbox-->>SearchThread: blocked waiting for space
SearchThread-->>AppThread: Never returns from join
Note over AppThread,Mailbox: DEADLOCK: both sides wait forever
Reviews (1): Last reviewed commit: "Document search-related freeze investiga..." | Re-trigger Greptile |
Summary
This PR documents a freeze I have been hitting frequently in the local cmux macOS app. The common pattern is that terminal search/find state is active or recently active, then a terminal surface is closed or torn down, and the app becomes unresponsive with the spinner.
I am opening this primarily as a problem report plus a concrete possible fix path. The diagnosis and proposed fix are entirely AI-suggested, so they should be treated as a candidate explanation/patch that needs careful review rather than a fully human-audited conclusion.
What was observed
A sampled hung cmux process showed the main thread blocked in Ghostty surface teardown:
ghostty_surface_freeSurface.deinitpthread_joinThe join point appears to be the per-surface Ghostty search thread shutdown.
Suspected cause
The suspected deadlock is:
Possible fix
I opened the AI-suggested Ghostty-side patch here:
The proposed patch makes search-thread callback delivery bounded/best-effort during teardown, so stale search UI reset messages cannot block surface destruction forever.
Local validation
The linked Ghostty patch was built locally into GhosttyKit and a tagged cmux debug build completed successfully:
Caveat
The freeze is real and it has been happening a lot for me locally. The root-cause analysis and fix are AI-assisted. Please review the Ghostty PR carefully, especially around search-thread callbacks, mailbox backpressure, and surface teardown ordering.
Summary by cubic
Adds a report on a freeze when closing a terminal surface while search is active or recently active. It captures a suspected join deadlock in
Ghosttysurface teardown, links to a proposed upstream patch, and notes local build validation.Written for commit d4b0126. Summary will update on new commits.
Summary by CodeRabbit