question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`ShadingIT` fails on macOS and Linux

See original GitHub issue

Expected behavior

The following commands should succeed:

$ ./mvnw install -DskipTests
$ cd testsuite-shading
$ ../mvnw clean integration-test failsafe:verify

Actual behavior

The above command fails with the following error:

[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.19 s <<< FAILURE! - in io.netty.testsuite.shading.ShadingIT
[ERROR] testShadingNativeTransport  Time elapsed: 0.374 s  <<< ERROR!
java.lang.UnsatisfiedLinkError: failed to load the required native library
	at io.netty.testsuite.shading.ShadingIT.testShading0(ShadingIT.java:54)
	at io.netty.testsuite.shading.ShadingIT.testShadingNativeTransport(ShadingIT.java:37)
Caused by: java.lang.NoClassDefFoundError: shaded2/io/netty/channel/kqueue/KQueueStaticallyReferencedJniMethods (wrong name: shaded2//io/netty/channel/kqueue/KQueueStaticallyReferencedJniMethods)
	at io.netty.testsuite.shading.ShadingIT.testShading0(ShadingIT.java:52)
	at io.netty.testsuite.shading.ShadingIT.testShadingNativeTransport(ShadingIT.java:37)
The complete test output:
22:01:56.060 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
22:01:56.062 [main] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
22:01:56.062 [main] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 11
22:01:56.063 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
22:01:56.063 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
22:01:56.063 [main] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.storeFence: available
22:01:56.063 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
22:01:56.063 [main] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: unavailable: Reflective setAccessible(true) disabled
22:01:56.064 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
22:01:56.064 [main] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable: class io.netty.util.internal.PlatformDependent0$7 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @75e32c4c
22:01:56.065 [main] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): unavailable
22:01:56.065 [main] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
22:01:56.071 [main] DEBUG io.netty.util.internal.PlatformDependent - maxDirectMemory: 8589934592 bytes (maybe)
22:01:56.071 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /var/folders/90/dr7vn6w14vzdt65wm4tfswwc0000gp/T (java.io.tmpdir)
22:01:56.071 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
22:01:56.072 [main] DEBUG io.netty.util.internal.PlatformDependent - Platform: MacOS
22:01:56.072 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: -1 bytes
22:01:56.072 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
22:01:56.073 [main] DEBUG io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
22:01:56.073 [main] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
22:01:56.076 [main] DEBUG shaded2.io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
22:01:56.090 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
22:01:56.090 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - Java version: 11
22:01:56.090 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
22:01:56.090 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
22:01:56.091 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.storeFence: available
22:01:56.091 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
22:01:56.091 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - direct buffer constructor: unavailable: Reflective setAccessible(true) disabled
22:01:56.091 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
22:01:56.092 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable: class shaded2.io.netty.util.internal.PlatformDependent0$7 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @75e32c4c
22:01:56.092 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): unavailable
22:01:56.092 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
22:01:56.092 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent - maxDirectMemory: 8589934592 bytes (maybe)
22:01:56.092 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: /var/folders/90/dr7vn6w14vzdt65wm4tfswwc0000gp/T (java.io.tmpdir)
22:01:56.092 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
22:01:56.092 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent - Platform: MacOS
22:01:56.093 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: -1 bytes
22:01:56.093 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
22:01:56.093 [main] DEBUG shaded2.io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
22:01:56.093 [main] DEBUG shaded2.io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
22:01:56.095 [main] DEBUG shaded2.io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.workdir: /var/folders/90/dr7vn6w14vzdt65wm4tfswwc0000gp/T (io.netty.tmpdir)
22:01:56.095 [main] DEBUG shaded2.io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.deleteLibAfterLoading: true
22:01:56.095 [main] DEBUG shaded2.io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.tryPatchShadedId: true
22:01:56.095 [main] DEBUG shaded2.io.netty.util.internal.NativeLibraryLoader - -Dio.netty.native.detectNativeLibraryDuplicates: true
22:01:56.110 [main] DEBUG shaded2.io.netty.util.internal.NativeLibraryLoader - Execution of 'install_name_tool -id Zu9wWlVpYUcosy50wS6A1VvqOI5ddgPAT8eIVm /var/folders/90/dr7vn6w14vzdt65wm4tfswwc0000gp/T/libshaded2_netty_transport_native_kqueue_aarch_641290578488165430543.dylib' succeed: 0
22:01:56.149 [main] DEBUG shaded2.io.netty.util.internal.NativeLibraryLoader - Execution of 'codesign -s - /var/folders/90/dr7vn6w14vzdt65wm4tfswwc0000gp/T/libshaded2_netty_transport_native_kqueue_aarch_641290578488165430543.dylib' succeed: 0
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.392 s <<< FAILURE! - in io.netty.testsuite.shading.ShadingIT
[ERROR] testShadingNativeTransport  Time elapsed: 0.385 s  <<< ERROR!
java.lang.UnsatisfiedLinkError: failed to load the required native library
	at io.netty.testsuite.shading.ShadingIT.testShading0(ShadingIT.java:54)
	at io.netty.testsuite.shading.ShadingIT.testShadingNativeTransport(ShadingIT.java:37)
Caused by: java.lang.NoClassDefFoundError: shaded2/io/netty/channel/kqueue/KQueueStaticallyReferencedJniMethods (wrong name: shaded2//io/netty/channel/kqueue/KQueueStaticallyReferencedJniMethods)
	at io.netty.testsuite.shading.ShadingIT.testShading0(ShadingIT.java:52)
	at io.netty.testsuite.shading.ShadingIT.testShadingNativeTransport(ShadingIT.java:37)

I see the similar failure for epoll on Linux ARM64 as well:

...
Caused by: java.lang.NoClassDefFoundError: shaded2/io/netty/channel/epoll/NativeStaticallyReferencedJniMethods (wrong name: shaded2//io/netty/channel/epoll/NativeStaticallyReferencedJniMethods)
	at io.netty.testsuite.shading.ShadingIT.testShading0(ShadingIT.java:52)
	at io.netty.testsuite.shading.ShadingIT.testShadingNativeTransport(ShadingIT.java:37)

What’s the current state of testsuite-shading? It is running as a part of the CI process?

Netty version

Branch 4.1 f901ea2e712d9d16e199aaeb7b622e36944eb8dd

JVM version (e.g. java -version)

macOS:

❯ java -version
openjdk version "11.0.14" 2022-01-18 LTS
OpenJDK Runtime Environment Zulu11.54+23-CA (build 11.0.14+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.54+23-CA (build 11.0.14+9-LTS, mixed mode)

Linux:

❯ java -version
openjdk version "11.0.8" 2020-07-14 LTS
OpenJDK Runtime Environment Zulu11.41+75-CA (build 11.0.8+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.41+75-CA (build 11.0.8+10-LTS, mixed mode)

OS version (e.g. uname -a)

macOS:

❯ uname -a
Darwin ... 21.4.0 Darwin Kernel Version 21.4.0: Mon Feb 21 20:35:58 PST 2022; root:xnu-8020.101.4~2/RELEASE_ARM64_T6000 arm64

Linux:

❯ uname -a
Linux ... 5.15.0-27-generic #28-Ubuntu SMP Thu Apr 14 12:56:31 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
trustincommented, May 3, 2022

OK. I have a fix. Let me clean it up and send out a PR tomorrow. I’ll also implement the rule documented here, so it handles a peculiar package name correctly, such as one with _ or a non-ASCII character.

0reactions
trustincommented, May 3, 2022

Thanks for looking, @normanmaurer. It looks like there’s a bug in parsePackagePrefix() - it appends an extra / at the end of the package prefix. Let me dig a little bit more and get back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

If an error occurred while updating or installing macOS
The message might say that an error occurred while downloading, preparing, or installing, or that the installer is damaged or could not be ......
Read more >
sed command with -i option failing on Mac, but works on Linux
I've created a function to handle sed difference between MacOS (tested on MacOS ... there is not a way to use sed portably...
Read more >
Run the client analyzer on macOS or Linux | Microsoft Learn
Running the analyzer using a terminal or SSH scenario. Open a terminal or SSH into the relevant machine and run the following commands:....
Read more >
macOS setlocale: LC_CTYPE: cannot change locale (UTF-8)
I am a new Apple OS X Mabbook user. I am getting an error which read as follows when I connect to any...
Read more >
pip Command Not Found – Mac and Linux Error Solved
When using Python, you might need to install and use certain packages. And there is a command available for that known as 'pip'....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found