-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
com.sun.jna.NativeLibraryTest fails on macOS 12 (Monterey) #1423
Comments
From my perspective you are seeing a flaky test. From the failing test:
Please rerun the test. |
I tried it twice more. I got the same result each time. |
Apache Ant(TM) version 1.10.12 compiled on October 13 2021 |
This comment was marked as outdated.
This comment was marked as outdated.
Thank you for the inspiration. I slightly modified the test and ran it in isolation with the Reading this: rust-lang/rust#28794 (comment) being able to unload a library on mac OS or derivates is not something I'd rely on. |
I tried changing all calls to |
Pinging @dyorgio, he's helped me with some obscure macOS issues in the past. 🍻 |
Here is the test setup: https://github.com/java-native-access/jna/tree/macos_debugging And this is the result: https://github.com/java-native-access/jna/actions/runs/3913589087/jobs/6689649929 |
I see two
Er, nevermind, there it is at Line 1247. |
I think I'm convinced this test should be removed (or altered to test the java-side reference, not the native handle), at least on macOS and possibly all *nix. The POSIX spec does not require the OS to unload the library:
and
Some other poking about indicates that there may be a
|
Digging deeper into that gnu flag @dbwiddis posted... https://bugzilla.redhat.com/show_bug.cgi?id=1083292 Perhaps LLVM relevant: https://reviews.llvm.org/D42865?id=132665 .. but since the diff only touched |
Here's something of interest. The
|
Yeah, I tried to coerce these here #1423 (comment) to no avail. Happy to be proven wrong. |
A comment on that report says that our test is the bug, and we simply should not be relying on unloading behavior by
|
I didn't specifically mention it, but I also tested forcing these directly in
I think this statement is true for general purposes, but even Apple staff say it should work if we're not using certain Object-C bindings. |
That statement was also relevant for 10.x. This new behavior is on 12.x (or possibly XCode 13). But the unloading behavior is simply not required by the standard, Apple (and any POSIX-compliant implementation) is free to change things, and we should not rely on it. |
Yeah that's my fear as well although it's good to exhaust all options before disabling the unit test on Apple. |
Hi @tresf, I'm not sure, but maybe editing DYLD_FALLBACK_LIBRARY_PATH before load could solve: Very nice repo 😄 : |
0774f82 master
java 17.0.2 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)
macOS Monterey 12.2.1 (21D62)
Apple M1 Pro
[junit] Testsuite: com.sun.jna.NativeLibraryTest
[junit] Tests run: 22, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 7.21 sec
[junit]
[junit] Testcase: testAvoidDuplicateLoads(com.sun.jna.NativeLibraryTest): FAILED
[junit] Library should be newly loaded after explicit dispose of all native libraries expected:<1> but was:<10>
[junit] junit.framework.AssertionFailedError: Library should be newly loaded after explicit dispose of all native libraries expected:<1> but was:<10>
[junit] at com.sun.jna.NativeLibraryTest.testAvoidDuplicateLoads(NativeLibraryTest.java:91)
[junit] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[junit] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[junit] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[junit]
[junit]
[junit] Test com.sun.jna.NativeLibraryTest FAILED
ant
The text was updated successfully, but these errors were encountered: