Fix stale native cache serving AVX build on CPUs without AVX (#401)#406
Merged
Conversation
NativeLibraryLoader validated its persistent cache by file size only. The AVX and SSE2 builds of WinTray.dll are both 23552 bytes, so after upgrading from a build that crashed on pre-2011 CPUs (no AVX) the loader kept serving the stale cached library and the crash survived the fix. Validate the cache by SHA-256 content hash instead, and add a CI guard that disassembles the built x64 DLL and fails if any AVX instruction is present (issue #401).
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
Closes the persistent crash reports on issue #401. Removing
/arch:AVX2(v1.3.1) already produces an AVX-freeWinTray.dll, but users kept crashing after upgrading because of a stale native library cache.NativeLibraryLoadervalidated its persistent cache (%LOCALAPPDATA%\composetray\native\…) by file size only.WinTray.dllare byte-for-byte the same size (23552 bytes), only the content differs (10 AVX instructions vs 0 — verified by disassembling the published v1.3.0 / v1.3.1 artifacts).EXCEPTION_ILLEGAL_INSTRUCTIONsurvived the fix on pre-2011 CPUs (Xeon E5520, Core 2 Duo).Changes
NativeLibraryLoader: validate the cache by SHA-256 content hash instead of size (reuses the existingsha256helpers, nowinternal).build-natives.yaml+CMakeLists.txtcomment): disassemble the built x64 DLL and fail the build if any AVX instruction is present, so/arch:AVX*can never silently regress.jvmTestsource set (the project had none) with a regression test.Test plan
./gradlew jvmTest— 3 tests pass; the key case asserts a same-size/different-content cache is treated as stale (the old size check would have accepted it)../gradlew ktlintCheck detekt— clean.