https://kotlinlang.org logo
#ktor
Title
# ktor
b

Bertram Kirsch

03/09/2021, 12:12 PM
Upgrading from 1.4.3 to 1.5.2 causes trouble with Netty Hello all, this is my first post to this Slack. I use Ktor to build the backend of a platform where podcasts can get sponsorships through host-read ads. While trying to upgrade Ktor from 1.4.3 to 1.5.2, I ran in some trouble with Netty. As I am still quite a newbie to the whole Kotlin/Ktor ecosystem, I have no clue what's going wrong. I use a HOCON File for configuration. I am lost. Any hint where I can start to look for a reason is welcome! Can someone please have a look at the stracktrace below?
Copy code
Responding at <http://0.0.0.0:9090>
Failed to initialize a channel. Closing: [id: 0xce532d4b, L:/[0:0:0:0:0:0:0:1]:9090 - R:/[0:0:0:0:0:0:0:1]:62473]
java.lang.NoSuchMethodError: 'kotlinx.coroutines.channels.Channel kotlinx.coroutines.channels.ChannelKt.Channel$default(int, kotlinx.coroutines.channels.BufferOverflow, kotlin.jvm.functions.Function1, int, java.lang.Object)'
	at io.ktor.server.netty.cio.NettyRequestQueue.<init>(NettyRequestQueue.kt:19)
	at io.ktor.server.netty.NettyChannelInitializer.configurePipeline(NettyChannelInitializer.kt:104)
	at io.ktor.server.netty.NettyChannelInitializer.initChannel(NettyChannelInitializer.kt:89)
	at io.ktor.server.netty.NettyChannelInitializer.initChannel(NettyChannelInitializer.kt:28)
	at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129)
	at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112)
	at io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:938)
	at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:609)
	at io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46)
	at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1463)
	at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1115)
	at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:650)
	at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:502)
	at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:417)
	at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:474)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.ktor.server.netty.EventLoopGroupProxy$Companion$create$factory$1$1.run(NettyApplicationEngine.kt:227)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:832)
r

Rustam Siniukov

03/09/2021, 12:30 PM
what version of coroutines do you use?
and can you try
1.4.2-native-mt
?
b

Bertram Kirsch

03/09/2021, 1:49 PM
Snap! Problem solved. Thank's a lot! Here ist what happened: I didn't set coroutines as an explicit dependency. Instead I use whatever gets pulled in by io.ktor:ktor-server-netty as transitive dependency. I missed an update to my new parent POM in one of my own dependencies. That's why 1.3.9-native-mt-2 was used instead of 1.4.2-native-mt
👍 1
3 Views