Repository navigation
macOS: app hangs after wake — ghostty_surface_free blocks on renderer stuck in CVDisplayLinkStop #14361
Unanswered
shyim
asked this question in
Issue Triage
Replies: 1 comment 2 replies
|
Claude fix was shyim@78f2acdf1 testing it out now few hours |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Issue Description
Ghostty's main thread hung for about 82 seconds shortly after my Mac woke from sleep, and the whole app stopped responding. macOS wrote a .hang report. The build that hung already includes #14171 (which fixed #14150); 56a3437 is 160 commits after its merge commit 82232ec. So this is a separate path to the same underlying CoreVideo stall.
What the stackshot shows:
#14171 made sure draw_mutex isn't held while stopping. But any CVDisplayLinkStop on the renderer thread can still block indefinitely, and the main thread joins that thread when freeing a surface, so a CoreVideo stall still freezes the app. Renderer.deinit also calls stop() directly on the main thread.
Possible fix: I have a local patch that moves all display-link start/stop onto a per-renderer serial dispatch queue (dispatch_async_f). Requests that arrive while one is queued are merged into one job. On teardown the callback is switched off, then stop and release run on that queue, so neither the renderer nor the main thread ever calls CVDisplayLinkStop directly. I'm glad to share it if this approach seems right.
Expected Behavior
Closing or freeing a surface never blocks the main thread. A stalled CoreVideo display link should at worst delay vsync for that surface, not hang the app
Actual Behavior
The main thread blocks in ghostty_surface_free waiting for the renderer thread, which is stuck in CVDisplayLinkStop. The app was unresponsive for about 82s
Reproduction Steps
It's intermittent, and I don't have a deterministic reproduction. It happens under these conditions:
Ghostty Logs
Ghostty Version
OS Version Information
macOS 27.0 (26A428), Mac15,9 (Apple Silicon)
(Linux only) Display Server
None
(Linux only) Desktop Environment/Window Manager
No response
Minimal Ghostty Configuration
Additional Relevant Configuration
No response
I acknowledge that:
```) on separate lines.All reactions