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.

Failed to use EpollEventLoopGroup in Alpine

See original GitHub issue

Expected behavior

Can create a Netty based server using EpollEventLoopGroup in Alpine

Actual behavior

Exception in debug:

17/06/12 07:49:50 DEBUG i.n.u.i.NativeLibraryLoader: -Dio.netty.tmpdir: /tmp (java.io.tmpdir)
17/06/12 07:49:50 DEBUG i.n.u.i.NativeLibraryLoader: -Dio.netty.native.workdir: /tmp (io.netty.tmpdir)
17/06/12 07:49:50 DEBUG i.n.u.i.NativeLibraryLoader: Unable to load the library '/tmp/libnetty-transport-native-epoll46794586764
45765506.so', trying other loading mechanism.
java.lang.UnsatisfiedLinkError: /tmp/libnetty-transport-native-epoll4679458676445765506.so: Error relocating /tmp/libnetty-trans
port-native-epoll4679458676445765506.so: __strndup: symbol not found
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
        at java.lang.Runtime.load0(Runtime.java:809)
        at java.lang.System.load(System.java:1086)
        at io.netty.util.internal.NativeLibraryUtil.loadLibrary(NativeLibraryUtil.java:36)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at io.netty.util.internal.NativeLibraryLoader$1.run(NativeLibraryLoader.java:272)
        at java.security.AccessController.doPrivileged(Native Method)
        at io.netty.util.internal.NativeLibraryLoader.loadLibraryByHelper(NativeLibraryLoader.java:264)
        at io.netty.util.internal.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:252)
        at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:226)
        at io.netty.channel.epoll.Native.loadNativeLibrary(Native.java:269)
        at io.netty.channel.epoll.Native.<clinit>(Native.java:64)
        at io.netty.channel.epoll.IovArray.<clinit>(IovArray.java:57)
        at io.netty.channel.epoll.EpollEventLoop.<init>(EpollEventLoop.java:54)
        at io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:117)
        at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:64)
        at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:50)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:93)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:80)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:61)
        at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:45)
        ...

Steps to reproduce

This line of code fails new EpollEventLoopGroup(1)

Minimal yet complete reproducer code (or URL to code)

new EpollEventLoopGroup(1)

Netty version

4.0.47.Final

Gradle dependencies used:

    compile 'io.netty:netty-all:4.0.47.Final'
    compile 'io.netty:netty-transport-native-epoll:4.0.47.Final:linux-x86_64'

JVM version (e.g. java -version)

openjdk version “1.8.0_121” OpenJDK Runtime Environment (IcedTea 3.3.0) (Alpine 8.121.13-r0) OpenJDK 64-Bit Server VM (build 25.121-b13, mixed mode)

OS version (e.g. uname -a)

Linux b36a0939a7e8 4.9.27-moby #1 SMP Thu May 11 04:01:18 UTC 2017 x86_64 Linux

Running using Alpine from this docker image: openjdk:8u121-alpine

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
asafmcommented, Jun 14, 2017

After reading Norman tweets on coding in C and JNI, I’ll just switch back to Ubuntu 😃 On Tue, 13 Jun 2017 at 18:56 Scott Mitchell notifications@github.com wrote:

PRs are welcome if you can make the JNI code more cross platform … of course it must still work on existing platforms

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/netty/netty/issues/6841#issuecomment-308163302, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8Y8ag9UCl3ItyGZMyvct-wzJTWx_kEks5sDrEOgaJpZM4N2w4_ .

1reaction
saamalikcommented, Jun 25, 2017

Probably not officially supported, but you can install the proper glibc in Alpine:

curl -sS -L -o /etc/apk/keys/sgerrand.rsa.pub http://raw.githubusercontent.com/sgerrand/alpine-pkg-glibc/master/sgerrand.rsa.pub
curl -sS -L -O http://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.25-r0/glibc-2.25-r0.apk
apk --no-cache add glibc-2.25-r0.apk

Tested it with Playframework/Netty and it works good! However, most of us who’re using Alpine are doing so in Docker containers (where the docker host VM is Linux–even on a Mac). Turns out that the performance difference between using native and jdk on Linux was very marginally in favor of native; presumambly because on Linux the selectors still use epoll. Anyway, I opted to keep the default “jdk” transport but instructions for anyone who’d like to use “native” transport + alpine is above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[HAP-1388] "rtDockerPublish" and "rtDockerPush" fails ... - JFrog
Problem statement: Unable to publish or push docker images through Jenkins declarative pipeline using the JFrog Artifactory plugin in ARM 32 ...
Read more >
[grpc-java 0.14.0] Use EpollEventLoopGroup in gRPC?
I tried to use EpollEventGroup on the server but it gives me an error that it's not a compatible event loop type. Is...
Read more >
Java SDK crashes the JVM on Alpine docker image
We are using the Docker image eclipse-temurin:17-alpine in a Spring ... A fatal error has been detected by the Java Runtime Environment:
Read more >
How to Communicate with Containerd Using Java - Medium
We'll work on the images API for this exercise so let's add ... EventLoopGroup elg = new EpollEventLoopGroup(); ... if there is an...
Read more >
EpollEventLoopGroup (Netty API Reference (4.1.85.Final))
Create a new instance using the specified number of threads and the default ThreadFactory . EpollEventLoopGroup(int nThreads, Executor executor).
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