Repository navigation
fix: load the native library once per JVM when NativeBase is reloaded - #17
Merged
Merged
Conversation
NativeBase.load() after setLoaded(false), which CometSparkSessionExtensionsSuite does to test the Arrow properties, unpacked libcomet to a new temporary file and loaded it again. The JVM then held two copies of the library with separate statics: native methods linked before the reload stayed bound to the first copy, methods first called after it bound to the second. Native.cancelPlan, first called only when a task is killed, looked up the plan in the second copy's empty registry, so CometNativeTaskKillSuite failed whenever it ran after that suite in the same JVM. load() now reapplies the logging and Arrow settings without loading the library a second time. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Problem
CometNativeTaskKillSuitefailed in every fulltest -pl sparkrun (2 of 4 tests: killed tasks never stopped), while passing when run alone.CometSparkSessionExtensionsSuite("Arrow properties") callsNativeBase.setLoaded(false)+NativeBase.load(). For the bundled library this unpacks libcomet to a new temp file andSystem.loads it again, so the JVM holds two copies with separate statics. Native methods linked before the reload stay bound to copy 1, methods first called after it bind to copy 2.Native.cancelPlanis first called only when a task is killed, so it looked up plans in copy 2's emptyPLAN_CANCELLATIONSregistry (found=false registry=0with plans running) and the kill never reached native code.Production is not affected: there the library is loaded once.
Change
NativeBase.load()remembers that the library is loaded in this JVM and, on a reload, only reapplies the logging init and Arrow properties.Verification
CometAggregateSuite, CometSparkSessionExtensionsSuite, CometNativeTaskKillSuitein one JVM: before 2 failed, after 156 passed / 0 failed;Arrow propertiespasses.🤖 Generated with Claude Code