netty / netty-tcnative

A fork of Apache Tomcat Native, based on finagle-native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

published netty-tcnative-boringssl-static jars are missing static libraries

mcettrick opened this issue · comments

I was working on updating my application to use the latest recommended netty-tcnative-boringssl-static as indicated here:

https://github.com/grpc/grpc-java/blob/master/SECURITY.md

But getting exceptions like this:

Caused by: java.lang.IllegalArgumentException: Failed to load any of the given libraries: [netty_tcnative_osx_x86_64, netty_tcnative_x86_64, netty_tcnative]
	at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:114)
	at io.netty.handler.ssl.OpenSsl.loadTcNative(OpenSsl.java:705)
	at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:146)
	... 21 common frames omitted
	Suppressed: java.lang.UnsatisfiedLinkError: could not load a native library: netty_tcnative_osx_x86_64
		at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:239)
		at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:105)
		... 23 common frames omitted
	Caused by: java.io.FileNotFoundException: META-INF/native/libnetty_tcnative_osx_x86_64.jnilib
		at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:181)
		... 24 common frames omitted

After investigating further, I noticed that the 2.0.54 jar is missing the static libraries:
https://mvnrepository.com/artifact/io.netty/netty-tcnative-boringssl-static/2.0.54.Final

.
./META-INF
./META-INF/MANIFEST.MF
./META-INF/maven
./META-INF/maven/io.netty
./META-INF/maven/io.netty/netty-tcnative-boringssl-static
./META-INF/maven/io.netty/netty-tcnative-boringssl-static/pom.xml
./META-INF/maven/io.netty/netty-tcnative-boringssl-static/pom.properties
./META-INF/INDEX.LIST

Versions 2.0.48 and earlier contain the libs:
https://mvnrepository.com/artifact/io.netty/netty-tcnative-boringssl-static/2.0.48.Final

Archive:  ../WEB-INF/lib/netty-tcnative-boringssl-static-2.0.48.Final.jar
  inflating: META-INF/MANIFEST.MF    
   creating: META-INF/license/
   creating: META-INF/native/
   creating: META-INF/maven/
   creating: META-INF/maven/io.netty/
   creating: META-INF/maven/io.netty/netty-tcnative-boringssl-static/
  inflating: META-INF/license/LICENSE.tomcat-native.txt  
  inflating: META-INF/license/LICENSE.boringssl.txt  
  inflating: META-INF/license/LICENSE.aix-netbsd.txt  
  inflating: META-INF/license/LICENSE.mvn-wrapper.txt  
  inflating: META-INF/native/libnetty_tcnative_linux_x86_64.so  
  inflating: META-INF/native/libnetty_tcnative_osx_aarch_64.jnilib  
  inflating: META-INF/native/netty_tcnative_windows_x86_64.dll  
  inflating: META-INF/native/libnetty_tcnative_linux_aarch_64.so  
  inflating: META-INF/native/libnetty_tcnative_osx_x86_64.jnilib  
  inflating: META-INF/NOTICE.txt     
  inflating: META-INF/LICENSE.txt    
  inflating: META-INF/maven/io.netty/netty-tcnative-boringssl-static/pom.xml  
  inflating: META-INF/maven/io.netty/netty-tcnative-boringssl-static/pom.properties  
  inflating: META-INF/INDEX.LIST    

It appears that in 2.0.49 (comparing file sizes betwen https://repo.maven.apache.org/maven2/io/netty/netty-tcnative-boringssl-static/2.0.49.Final/ vs https://repo.maven.apache.org/maven2/io/netty/netty-tcnative-boringssl-static/2.0.48.Final/ the shared libraries were moved out of the main artifact, so we'll need to use the classifier artifacts as a stopgap.

This does seem to be at odds with what is listed in here https://github.com/netty/netty/wiki/Forked-Tomcat-Native#artifacts
Seemed to be caused by 6fb5b01

Thanks @yuzawa-san, we discovered the os-specific artifacts and have switched to those. I think this issue will confuse gRPC developers and should be fixed.

This also impacts Apache Beam where the lack of an uber jar complicates the experience for users since they need to package a version that is compatible with their local environment (e.g. windows, mac, ...) and a remote environment (e.g. a Linux VM running on a cloud).