You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[macOS] Piko becomes unresponsive when opening a video in the built-in player #69
When I open a video in Piko's built-in player, the entire app becomes unresponsive. I have to force quit Piko to use it again.
I reviewed the playback options under Settings → Browsing & playback. The freeze occurs with both Hardware decoding and Software.
It also occurs at the lowest available playback quality and after clearing the app cache.
Thanks for the report and log!
To pinpoint where it's hanging, could you capture a process sample while Piko is unresponsive?
Reproduce the freeze.
Open Activity Monitor, select Piko, and click the ... menu → Sample Process (or run sample $(pgrep -x Piko) 5 -file ~/Desktop/piko-sample.txt in Terminal).
Attach the saved sample file here.
If you can also check whether opening an audio file or using an external player works normally, that would help us narrow it down further.
I hit the same freeze on 1.7.0 (macOS 27.3, Apple M4) right after opening the clip feed / a preview player window, and captured a sample while Piko was unresponsive. It looks like an AppKit main thread ↔ EDT deadlock in the title bar setup.
MacTitleBarEffect calls SkiaLayer.disableTitleBar() from a LaunchedEffect, i.e. on the EDT.
Skiko's native -[LayerHandler disableTitlebar:] (Drawlayer.mm, v0.156.1) does dispatch_sync(dispatch_get_main_queue(), …).
If at that moment the AppKit main thread is inside LWCToolkit.doAWTRunLoop (the nested run loop used by LWCToolkit.invokeAndWait, running in javaRunLoopMode, which does not drain the GCD main queue), it is waiting for the EDT while the EDT is waiting for the main queue → permanent deadlock. The process stays alive (background sync keeps logging) but the UI never recovers.
It is timing dependent, which fits it happening when a new window (player / clip preview) is shown.
Workaround I tested locally
Call disableTitleBar off the EDT so only a background thread blocks on dispatch_sync; the main thread can finish its nested loop, return to the default mode and then run the block:
I built :desktopApp from the v1.7.0 tag with this change, swapped the two changed classes into my installed 1.7.0 jar, and the app starts normally with the title bar applied as before. Since the bug is timing dependent I can't prove a negative yet; I'll report back if it freezes again.
One caveat: the native osxDisableTitleBar looks up the layer by iterating Skiko's global layerStorage (NSMutableSet), which is otherwise mutated on the EDT when layers are created/disposed, so calling it off the EDT has a small theoretical race. A cleaner long-term fix might be in Skiko itself (e.g. dispatch_async, or not blocking when the caller is the EDT), but the change above seems like a low-risk mitigation for Piko.
I hit the same freeze on 1.7.0 (macOS 27.3, Apple M4) right after opening the clip feed / a preview player window, and captured a sample while Piko was unresponsive. It looks like an AppKit main thread ↔ EDT deadlock in the title bar setup.
MacTitleBarEffect calls SkiaLayer.disableTitleBar() from a LaunchedEffect, i.e. on the EDT.
Skiko's native -[LayerHandler disableTitlebar:] (Drawlayer.mm, v0.156.1) does dispatch_sync(dispatch_get_main_queue(), …).
If at that moment the AppKit main thread is inside LWCToolkit.doAWTRunLoop (the nested run loop used by LWCToolkit.invokeAndWait, running in javaRunLoopMode, which does not drain the GCD main queue), it is waiting for the EDT while the EDT is waiting for the main queue → permanent deadlock. The process stays alive (background sync keeps logging) but the UI never recovers.
It is timing dependent, which fits it happening when a new window (player / clip preview) is shown.
Workaround I tested locally
Call disableTitleBar off the EDT so only a background thread blocks on dispatch_sync; the main thread can finish its nested loop, return to the default mode and then run the block:
if (layer != null) withContext(Dispatchers.IO) { layer.disableTitleBar(TitleBarHeight.value) }
MacOs.patchTitleBarDoubleClick()
}
}
I built :desktopApp from the v1.7.0 tag with this change, swapped the two changed classes into my installed 1.7.0 jar, and the app starts normally with the title bar applied as before. Since the bug is timing dependent I can't prove a negative yet; I'll report back if it freezes again.
One caveat: the native osxDisableTitleBar looks up the layer by iterating Skiko's global layerStorage (NSMutableSet), which is otherwise mutated on the EDT when layers are created/disposed, so calling it off the EDT has a small theoretical race. A cleaner long-term fix might be in Skiko itself (e.g. dispatch_async, or not blocking when the caller is the EDT), but the change above seems like a low-risk mitigation for Piko.
Thanks a lot for digging into this and capturing the sample!
Your approach looks good as a workaround on Piko's side. If it holds up in your testing, would you be up for opening a PR?
Thanks for sharing the sample and the workaround.
I’ll test calling disableTitleBar() after pack() and before showing the player window, following Skiko’s AWT example.
If it holds up after repeatedly opening and closing the player on my Mac, I’ll share the results here and open a PR with the change.
Thanks for digging into this, @YSoung99. I tried following the Skiko AWT sample by calling window.pack() before disableTitleBar() and before showing the window. On my macOS setup with JDK 25, calling pack() that early caused problems during Piko’s window initialization. Skiko AWT sample
I think your approach of moving disableTitleBar() off the EDT is the most practical workaround for Piko right now.
Activity
NihilDigit commentedon Dec 2, 2026
Thanks for the report and log!
To pinpoint where it's hanging, could you capture a process sample while Piko is unresponsive?
If you can also check whether opening an audio file or using an external player works normally, that would help us narrow it down further.
YSoung99 commentedon Dec 2, 2026
I hit the same freeze on 1.7.0 (macOS 27.3, Apple M4) right after opening the clip feed / a preview player window, and captured a
samplewhile Piko was unresponsive. It looks like an AppKit main thread ↔ EDT deadlock in the title bar setup.Sample (relevant threads, 815/815 samples identical):
What I think is happening
MacTitleBarEffectcallsSkiaLayer.disableTitleBar()from aLaunchedEffect, i.e. on the EDT.-[LayerHandler disableTitlebar:](Drawlayer.mm, v0.156.1) doesdispatch_sync(dispatch_get_main_queue(), …).LWCToolkit.doAWTRunLoop(the nested run loop used byLWCToolkit.invokeAndWait, running injavaRunLoopMode, which does not drain the GCD main queue), it is waiting for the EDT while the EDT is waiting for the main queue → permanent deadlock. The process stays alive (background sync keeps logging) but the UI never recovers.Workaround I tested locally
Call
disableTitleBaroff the EDT so only a background thread blocks ondispatch_sync; the main thread can finish its nested loop, return to the default mode and then run the block:I built
:desktopAppfrom the v1.7.0 tag with this change, swapped the two changed classes into my installed 1.7.0 jar, and the app starts normally with the title bar applied as before. Since the bug is timing dependent I can't prove a negative yet; I'll report back if it freezes again.One caveat: the native
osxDisableTitleBarlooks up the layer by iterating Skiko's globallayerStorage(NSMutableSet), which is otherwise mutated on the EDT when layers are created/disposed, so calling it off the EDT has a small theoretical race. A cleaner long-term fix might be in Skiko itself (e.g.dispatch_async, or not blocking when the caller is the EDT), but the change above seems like a low-risk mitigation for Piko.NihilDigit commentedon Dec 2, 2026
Thanks a lot for digging into this and capturing the sample!
Your approach looks good as a workaround on Piko's side. If it holds up in your testing, would you be up for opening a PR?
K-MarkLee commentedon Dec 2, 2026
Thanks for sharing the sample and the workaround.
I’ll test calling
disableTitleBar()afterpack()and before showing the player window, following Skiko’s AWT example.If it holds up after repeatedly opening and closing the player on my Mac, I’ll share the results here and open a PR with the change.
K-MarkLee commentedon Dec 2, 2026
Thanks for digging into this, @YSoung99. I tried following the Skiko AWT sample by calling window.pack() before disableTitleBar() and before showing the window. On my macOS setup with JDK 25, calling pack() that early caused problems during Piko’s window initialization. Skiko AWT sample
I think your approach of moving disableTitleBar() off the EDT is the most practical workaround for Piko right now.