Skip to content
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

EpollEventLoop fails to initialize #4840

Closed
blucas opened this issue Feb 4, 2016 · 10 comments
Closed

EpollEventLoop fails to initialize #4840

blucas opened this issue Feb 4, 2016 · 10 comments
Assignees
Labels
Milestone

Comments

@blucas
Copy link
Contributor

blucas commented Feb 4, 2016

Netty Version: 4.1 latest snapshot

I get the following exception when attempting to use Epoll. None of my code has changed, I just grabbed the latest snapshot jars. Could it have anything to do with 075a54a ??? I have not shaded my app or anything.

Caused by: java.lang.NoClassDefFoundError: Could not initialize class io.netty.channel.epoll.IovArray
        at io.netty.channel.epoll.EpollEventLoop.<init>(EpollEventLoop.java:57)
        at io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:78)
        at io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:30)
        at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:77)
        at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:48)
        at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:57)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:63)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:51)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:43)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:36)
@blucas
Copy link
Contributor Author

blucas commented Feb 4, 2016

@Scottmitch @normanmaurer - Any ideas guys? this is kinda worrying me, especially considering Norman tagged CR2

@blucas
Copy link
Contributor Author

blucas commented Feb 4, 2016

On a related note, I get the following exception when attempting to start and SSL service:

java.lang.NoSuchMethodError: org.apache.tomcat.jni.SSLContext.getMode(J)I
    at io.netty.handler.ssl.OpenSslContext.<init>(OpenSslContext.java:202)
    at io.netty.handler.ssl.OpenSslContext.<init>(OpenSslContext.java:134)
    at io.netty.handler.ssl.OpenSslServerContext.<init>(OpenSslServerContext.java:420)
    at io.netty.handler.ssl.SslContext.newServerContextInternal(SslContext.java:408)
    at io.netty.handler.ssl.SslContextBuilder.build(SslContextBuilder.java:315)

Update: This looks like it is happening because I am using Fork11 of TCNative.

@normanmaurer
Copy link
Member

@blucas the second is because you need to use netty-tcnative-1.1.33.Fork12. The other maybe @Scottmitch has an idea ?

@normanmaurer
Copy link
Member

@blucas is the same happen with CR2 ? (non snapshot)

@blucas
Copy link
Contributor Author

blucas commented Feb 5, 2016

Same thing happens. I just noticed another stack trace higher up that might give us a better clue:

Caused by: java.lang.UnsatisfiedLinkError: unsupported JNI version 0xFFFFFFFF required by /tmp/libnetty-transport-native-epoll1356421042500119665.so
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
        at java.lang.Runtime.load0(Runtime.java:795)
        at java.lang.System.load(System.java:1062)
        at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:193)
        at io.netty.channel.epoll.Native.<clinit>(Native.java:60)
        at io.netty.channel.epoll.IovArray.<clinit>(IovArray.java:57)
        at io.netty.channel.epoll.EpollEventLoop.<init>(EpollEventLoop.java:57)
        at io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:78)
        at io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:30)
        at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:77)
        at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:48)
        at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:57)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:63)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:51)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:43)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:36)

This makes me think it definitely has something to do with @Scottmitch's changes to support shading. FYI, I'm using Java 7 runtime, I don't know if that makes a difference for JNI support.

Edit: @normanmaurer - if you can jump on IRC we can discuss it further

@blucas
Copy link
Contributor Author

blucas commented Feb 5, 2016

Update: If I revert 075a54a the issue is no longer present and everything works as expected

@Scottmitch Scottmitch self-assigned this Feb 5, 2016
@Scottmitch Scottmitch added this to the 4.1.0.CR3 milestone Feb 5, 2016
@Scottmitch
Copy link
Member

@blucas - Sorry for the snag ... let me dig in here

@blucas
Copy link
Contributor Author

blucas commented Feb 5, 2016

@Scottmitch - sent you an email (via your gmail account) with some more info

@Scottmitch
Copy link
Member

@blucas - I was able to reproduce locally stay tuned for a PR.

Scottmitch added a commit to Scottmitch/netty that referenced this issue Feb 6, 2016
Motivation:
netty_epoll_native.c uses dladdr in attempt to get the name of the library that the code is running in. However the address passed to this funciton (JNI_OnLoad) may not be unique in the context of the application which loaded it. For example if another JNI library is loaded this address may first resolve to the other JNI library and cause the path name parsing to fail, which will cause the library to fail.

Modifications:
- Pass an addresses which is local to the current library to dladdr

Result:
EPOLL JNI library can be loaded in an environment where multiple JNI libraries are loaded.
Fixes netty#4840
normanmaurer pushed a commit that referenced this issue Feb 6, 2016
Motivation:
netty_epoll_native.c uses dladdr in attempt to get the name of the library that the code is running in. However the address passed to this funciton (JNI_OnLoad) may not be unique in the context of the application which loaded it. For example if another JNI library is loaded this address may first resolve to the other JNI library and cause the path name parsing to fail, which will cause the library to fail.

Modifications:
- Pass an addresses which is local to the current library to dladdr

Result:
EPOLL JNI library can be loaded in an environment where multiple JNI libraries are loaded.
Fixes #4840
@normanmaurer
Copy link
Member

Fixed by #4851

@normanmaurer normanmaurer reopened this Feb 6, 2016
pulllock pushed a commit to pulllock/netty that referenced this issue Oct 19, 2023
Motivation:
netty_epoll_native.c uses dladdr in attempt to get the name of the library that the code is running in. However the address passed to this funciton (JNI_OnLoad) may not be unique in the context of the application which loaded it. For example if another JNI library is loaded this address may first resolve to the other JNI library and cause the path name parsing to fail, which will cause the library to fail.

Modifications:
- Pass an addresses which is local to the current library to dladdr

Result:
EPOLL JNI library can be loaded in an environment where multiple JNI libraries are loaded.
Fixes netty#4840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants