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

Micronaut can't be launched #1963

Open
William-DQN opened this issue Oct 1, 2024 · 1 comment
Open

Micronaut can't be launched #1963

William-DQN opened this issue Oct 1, 2024 · 1 comment
Assignees
Labels
wait for reply Need more information from reporter

Comments

@William-DQN
Copy link

Hello everyone,

I am currently updating AKHQ form the v0.24 to the v0.25. I got an error cause by Micronaut. For some reason, the latest version (v0.25 and even v0.25.1 ) can't display the web UI and return a bad gateway error. Java is at v17. I'm using NGINX as a Proxy to redirect to a remote server.
#####################################
$ java --version
openjdk 17.0.11 2024-04-16 LTS
OpenJDK Runtime Environment (Red_Hat-17.0.11.0.9-3) (build 17.0.11+9-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.11.0.9-3) (build 17.0.11+9-LTS, mixed mode, sharing)
#####################################################################

When I run the v0.24, I got an error with the used port, but the AKHQ service can run correctly :
$ /usr/bin/java -Dmicronaut.config.files=/etc/akhq/application.yml -Dio.netty.native.workdir=/etc/akhq/tmp -jar /etc/akhq/akhq-0.24.0-all.jar


| / () ___ _ __ ___ _ __ __ _ _ | |
| |/| | |/ | '/ _ | '
\ / ` | | | | |
| | | | | (
| | | (
) | | | | (| | || | |_
|| |||___|| ___/|| ||_,|_,|__|
Micronaut (v3.8.8)

2024-09-24 15:32:28,734 ERROR main i.m.h.s.n.NettyHttpServer Unable to start server. Port *:8080 already in use.
2024-09-24 15:32:28,766 ERROR main i.m.runtime.Micronaut Error starting Micronaut server: Unable to start Micronaut server on *:8080
io.micronaut.http.server.exceptions.ServerStartupException: Unable to start Micronaut server on *:8080
at io.micronaut.http.server.netty.NettyHttpServer.bind(NettyHttpServer.java:541)
at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:281)
at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:104)
at io.micronaut.runtime.Micronaut.lambda$start$2(Micronaut.java:81)
at java.base/java.util.Optional.ifPresent(Optional.java:178)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:79)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:323)
at io.micronaut.runtime.Micronaut.run(Micronaut.java:309)
at org.akhq.App.main(App.java:27)
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:555)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:141)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:562)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:600)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:579)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:260)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:840)
$ lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 311737 will 69u IPv6 294727857 0t0 TCP *:webcache (LISTEN)
###################################################################################################

askakhq

As you can see, Micronaut run correctly even if it return some errors. And the AKHQ's UI is still reachable.

When I run the v0.25, I got the same errors with the used port, but Micronaut didn't run :

$ /usr/bin/java -Dmicronaut.config.files=/etc/akhq/application.yml -Dio.netty.native.workdir=/etc/akhq/tmp -jar /etc/akhq/akhq-0.25.0-all.jar
2024-10-01 14:18:22,476 DEBUG ForkJoinPool.commonPool-worker-2 i.m.c.u.i.l.InternalLoggerFactory Using SLF4J as the default logging framework
2024-10-01 14:18:22,530 DEBUG ForkJoinPool.commonPool-worker-2 i.n.u.i.l.InternalLoggerFactory Using SLF4J as the default logging framework
2024-10-01 14:18:22,531 DEBUG ForkJoinPool.commonPool-worker-2 i.n.u.i.InternalThreadLocalMap -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
2024-10-01 14:18:22,532 DEBUG ForkJoinPool.commonPool-worker-2 i.n.u.i.InternalThreadLocalMap -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
2024-10-01 14:18:22,938 DEBUG main i.n.util.internal.PlatformDependent0 -Dio.netty.noUnsafe: false
2024-10-01 14:18:22,939 DEBUG main i.n.util.internal.PlatformDependent0 Java version: 17
2024-10-01 14:18:22,940 DEBUG main i.n.util.internal.PlatformDependent0 sun.misc.Unsafe.theUnsafe: available
2024-10-01 14:18:22,940 DEBUG main i.n.util.internal.PlatformDependent0 sun.misc.Unsafe.copyMemory: available
2024-10-01 14:18:22,940 DEBUG main i.n.util.internal.PlatformDependent0 sun.misc.Unsafe.storeFence: available
2024-10-01 14:18:22,941 DEBUG main i.n.util.internal.PlatformDependent0 java.nio.Buffer.address: available
2024-10-01 14:18:22,941 DEBUG main i.n.util.internal.PlatformDependent0 direct buffer constructor: unavailable: Reflective setAccessible(true) disabled
2024-10-01 14:18:22,941 DEBUG main i.n.util.internal.PlatformDependent0 java.nio.Bits.unaligned: available, true
2024-10-01 14:18:22,942 DEBUG main i.n.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 @6a463b3d
2024-10-01 14:18:22,943 DEBUG main i.n.util.internal.PlatformDependent0 java.nio.DirectByteBuffer.(long, {int,long}): unavailable
2024-10-01 14:18:22,943 DEBUG main i.n.util.internal.PlatformDependent sun.misc.Unsafe: available
2024-10-01 14:18:22,943 DEBUG main i.n.util.internal.PlatformDependent -Dio.netty.tmpdir: /tmp (java.io.tmpdir)
2024-10-01 14:18:22,943 DEBUG main i.n.util.internal.PlatformDependent -Dio.netty.bitMode: 64 (sun.arch.data.model)
2024-10-01 14:18:22,944 DEBUG main i.n.util.internal.PlatformDependent -Dio.netty.maxDirectMemory: -1 bytes
2024-10-01 14:18:22,944 DEBUG main i.n.util.internal.PlatformDependent -Dio.netty.uninitializedArrayAllocationThreshold: -1
2024-10-01 14:18:22,944 DEBUG main io.netty.util.internal.CleanerJava9 java.nio.ByteBuffer.cleaner(): available
2024-10-01 14:18:22,944 DEBUG main i.n.util.internal.PlatformDependent -Dio.netty.noPreferDirect: false
2024-10-01 14:18:22,947 DEBUG main i.n.u.internal.NativeLibraryLoader -Dio.netty.native.workdir: /etc/opt/app/a2066/akhq/tmp
2024-10-01 14:18:22,947 DEBUG main i.n.u.internal.NativeLibraryLoader -Dio.netty.native.deleteLibAfterLoading: true
2024-10-01 14:18:22,947 DEBUG main i.n.u.internal.NativeLibraryLoader -Dio.netty.native.tryPatchShadedId: true
2024-10-01 14:18:22,947 DEBUG main i.n.u.internal.NativeLibraryLoader -Dio.netty.native.detectNativeLibraryDuplicates: true
2024-10-01 14:18:22,951 DEBUG main io.netty.util.ResourceLeakDetector -Dio.netty.leakDetection.level: simple
2024-10-01 14:18:22,952 DEBUG main io.netty.util.ResourceLeakDetector -Dio.netty.leakDetection.targetRecords: 4
2024-10-01 14:18:22,961 DEBUG main i.n.u.concurrent.GlobalEventExecutor -Dio.netty.globalEventExecutor.quietPeriodSeconds: 1
2024-10-01 14:18:22,974 DEBUG main i.n.c.MultithreadEventLoopGroup -Dio.netty.eventLoopThreads: 16
2024-10-01 14:18:22,978 DEBUG main io.netty.channel.nio.NioEventLoop -Dio.netty.noKeySetOptimization: false
2024-10-01 14:18:22,978 DEBUG main io.netty.channel.nio.NioEventLoop -Dio.netty.selectorAutoRebuildThreshold: 512
2024-10-01 14:18:22,982 DEBUG main i.n.util.internal.PlatformDependent org.jctools-core.MpscChunkedArrayQueue: available
2024-10-01 14:18:23,006 DEBUG main io.netty.channel.DefaultChannelId -Dio.netty.processId: 481043 (auto-detected)
2024-10-01 14:18:23,008 DEBUG main io.netty.util.NetUtil -Djava.net.preferIPv4Stack: false
2024-10-01 14:18:23,008 DEBUG main io.netty.util.NetUtil -Djava.net.preferIPv6Addresses: false
2024-10-01 14:18:23,009 DEBUG main i.netty.util.NetUtilInitializations Loopback interface: lo (lo, 0:0:0:0:0:0:0:1%lo)
2024-10-01 14:18:23,010 DEBUG main io.netty.util.NetUtil /proc/sys/net/core/somaxconn: 2048
2024-10-01 14:18:23,011 DEBUG main io.netty.channel.DefaultChannelId -Dio.netty.machineId: 00:50:56:ff:fe:a9:53:d4 (auto-detected)
2024-10-01 14:18:23,028 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.numHeapArenas: 16
2024-10-01 14:18:23,028 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.numDirectArenas: 16
2024-10-01 14:18:23,028 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.pageSize: 8192
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.maxOrder: 3
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.chunkSize: 65536
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.smallCacheSize: 256
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.normalCacheSize: 64
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.maxCachedBufferCapacity: 32768
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.cacheTrimInterval: 8192
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.cacheTrimIntervalMillis: 0
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.useCacheForAllThreads: false
2024-10-01 14:18:23,029 DEBUG main i.n.buffer.PooledByteBufAllocator -Dio.netty.allocator.maxCachedByteBuffersPerChunk: 1023
2024-10-01 14:18:23,036 DEBUG main io.netty.buffer.ByteBufUtil -Dio.netty.allocator.type: pooled
2024-10-01 14:18:23,036 DEBUG main io.netty.buffer.ByteBufUtil -Dio.netty.threadLocalDirectBufferSize: 0
2024-10-01 14:18:23,036 DEBUG main io.netty.buffer.ByteBufUtil -Dio.netty.maxThreadLocalCharBufferSize: 16384
2024-10-01 14:18:23,037 DEBUG main i.n.b.ChannelInitializerExtensions -Dio.netty.bootstrap.extensions: null
2024-10-01 14:18:23,048 ERROR main i.m.h.server.netty.NettyHttpServer Unable to start server. Port *:8080 already in use.
2024-10-01 14:18:23,154 ERROR main io.micronaut.runtime.Micronaut Error starting Micronaut server: Unable to start Micronaut server on *:8080
io.micronaut.http.server.exceptions.ServerStartupException: Unable to start Micronaut server on *:8080
at io.micronaut.http.server.netty.NettyHttpServer.bind(NettyHttpServer.java:612)
at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:292)
at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:109)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:80)
at org.akhq.App.main(App.java:29)
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:555)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:141)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:562)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:600)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:579)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:260)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:380)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:840)
$ lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 323305 will 70u IPv6 294819863 0t0 TCP *:webcache (LISTEN)
###################################################################################################

As Micronaut don't run, I got a "502 Bad GAteway" error:
probakhq

Here's my application.yml :
micronaut:
server:
port: 8080
context-path: "/akhq"
security:
enabled: true
token:
jwt:
signatures:
secret:
generator:
secret: {{ akhq_jwt_token }}

###################################################################################################

In these 2 cases it's like the process was launched twice by itself, but the v0.25 could not handle it. And couldn't works. The problem is not the port because whatever port provides the same issue, I've tried 28080 for example and it's the same result. Do you have any idea about this issue or if something about Micronaut change between the v0.24 and the v0.25? Does the problem come from JAVA ?

@AlexisSouquiere
Copy link
Collaborator

I think you should check exactly what is running on your server because there is a collision with something running on the 8080 port. I don't know how it was working in 0.24.0 but if Micronaut is not able to start, AKHQ shouldn't be working.

The Micronaut version was updated in 0.25.0 so something may have change in the way Micronaut handle this issue but the root cause is somewhere else for me. I tried to run the akhq-0.25.1-all.jar just to be sure and it worked fine.

@AlexisSouquiere AlexisSouquiere self-assigned this Oct 16, 2024
@AlexisSouquiere AlexisSouquiere added the wait for reply Need more information from reporter label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wait for reply Need more information from reporter
Projects
Status: Backlog
Development

No branches or pull requests

2 participants