fix(windows): load WinTray via Nucleus content-addressed cache - #427
Merged
Conversation
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.
Fixes NucleusFramework/Nucleus#534 and #426.
Two Windows processes that both depend on ComposeNativeTray used to extract
WinTray.dllto the same fixed cache path. ASystem.loadfrom the first process locks the file, so the second process either hitsAccessDeniedExceptiononFiles.move(REPLACE_EXISTING)or overwrites the locked DLL and then fails to load it.The SHA-256 skip already shipped in 2.0.3 only helps when both processes have identical bytes. Different versions, a local rebuild, or a cold-start race still try to replace the shared file.
Summary
NativeLibraryLoaderand load Win/Linux/macOS tray natives throughdev.nucleusframework.core.runtime.NativeLibraryLoader%LOCALAPPDATA%/nucleus/native/<platform>/<crc-size>/) so versions never share a file and an existing extract is never replacedwin32-x64,win32-aarch64,linux-x64,darwin-x64)libMacTray.dylib/libLinuxTray.sofrom the Nucleus cache after a native rebuildTest plan
jvmTest—Issue534ReproTest(Windows deniesFiles.moveonto a loaded DLL; second JVM with a different binary loads withoutAccessDeniedException). Also green on CI (natives + gradle).System.loadWinTray and stay alive together (two same-version processes can both load WinTray).%LOCALAPPDATA%\composetray\native\win32-x86-64\WinTray.dllwhile this branch loads from the Nucleus content-addressed cache (published 2_0_3 and this branch can load WinTray at the same time).