fix(macos): tray init deadlock on the Nucleus Tao backend#423
Merged
Conversation
…hing on a dedicated thread startTray() spawned MacTray-Thread and blocked the caller on a CountDownLatch until nativeInitTray completed. tray_init hops to the GCD main queue when called off the macOS main thread — but on the Nucleus Tao backend the caller IS the main thread, parked on the latch inside the event-loop callback, so the main queue never drained and the app deadlocked at startup. Run create/init inline on the calling thread: tray_init executes directly when already on the main thread and main.syncs otherwise (the main thread is free in that case). Drop the tray_loop polling loop too — status-item events are delivered by the application's own AppKit run loop, and pumping nextEvent from a background thread's main.sync could steal events from the real loop.
nativeInstallMouseHook/nativeRunMouseHookLoop/nativeStopMouseHook/ nativeGetLastMouseHookClick had no Kotlin callers (JNA-era leftover). The implementation also invoked the Java callback inside the WH_MOUSE_LL proc, which stalls the system-wide mouse during any JVM safepoint — removed so the pattern cannot be reused.
publishToMavenLocal failed locally with 'no configured signatory'. CI keeps signing through ORG_GRADLE_PROJECT_signingInMemoryKey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
startTray()spawnedMacTray-Threadand blocked the caller on aCountDownLatchuntilnativeInitTraycompleted.tray_inithops to the GCD main queue when called off the macOS main thread — but on the Nucleus Tao backend the caller IS the main thread, parked on the latch inside the event-loop callback, so the main queue never drained and the app deadlocked a few seconds after startup (reported via spindump on CozySpace 1.2.2).tray_initexecutes directly when already on the main thread, andmain.syncs otherwise (the main thread is free in that case). The 100 mstray_looppolling loop is gone — status-item events are delivered by the application's own AppKit run loop.nativeInstallMouseHook& co, no Kotlin callers): its implementation invoked the Java callback inside the WH_MOUSE_LL proc, which stalls the system-wide mouse during any JVM safepoint — removed so the pattern cannot be reused.signingInMemoryKeyis present, sopublishToMavenLocalworks locally; CI signing is unchanged (ORG_GRADLE_PROJECT_signingInMemoryKey).Test plan
publishToMavenLocalsucceeds without signing keys