Epoll based Netty Transport error in Function Development Tool on Linux · Issue #373 · Azure/azure-functions-java-worker (original) (raw)
Function Development Tool on Linux (I guess this is true for production Linux Function as well) fails when using "Epoll based Netty Transport" in the application. The issue can be reproduced by creating a function app with netty modules as it dependency along with "netty-Epoll-for-Linux".
Steps to reproduce:
Create an Azure Ubuntu 18.04 Linux VM.
SSH and set up
Set Package feed:
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
Install Function tool:
sudo apt-get install azure-functions-core-tools-3
Intstall Java8:
sudo add-apt-repository --remove ppa:webupd8team/java
sudo apt install apt-transport-https && sudo apt update && sudo apt install -y openjdk-8-jdk
Set JAVA_HOME:
Find path to Java 8:
sudo update-alternatives --config java
Example: > /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Open environment file:
Set Java home, save and exit:
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
Reload environment:
Install Maven:
Download repro-function project to this Linux box, package and Run:
mvn clean package
mvn azure-functions:run &
Hit function endpoint:
curl http://localhost:7071/api/HttpExample?name=hello
You should get the below error:
Caused by: java.lang.NoSuchMethodError:
io.netty.channel.SingleThreadEventLoop.<init>(Lio/netty/channel/EventLoopGroup;Ljava/util/concurrent/Executor;ZLjava/util/Queue;Ljava/util/Queue;Lio/netty/util/concurrent/RejectedExecutionHandler;)V
at io.netty.channel.epoll.EpollEventLoop.<init>(EpollEventLoop.java:87)
at io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:143)
at io.netty.channel.epoll.EpollEventLoopGroup.newChild(EpollEventLoopGroup.java:35)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:84)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:58)
at io.netty.util.concurrent.MultithreadEventExecutorGroup.<init>(MultithreadEventExecutorGroup.java:47)
at io.netty.channel.MultithreadEventLoopGroup.<init>(MultithreadEventLoopGroup.java:59)
at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:104)
at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:91)
at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:68)
at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:52)
at io.netty.channel.epoll.EpollEventLoopGroup.<init>(EpollEventLoopGroup.java:45)
at org.example.Function.doHttpGet(Function.java:71)
at org.example.Function.run(Function.java:55)
... 16 more
Here is a normal console app, having the same netty dependencies but runs fine
Download this project to the above Linux box and run:
mvn clean compile exec:java
The Epoll based code work as expected.