OrionPowered / Orion

High performance, bare-bones Minecraft server software
GNU General Public License v3.0
3 stars 2 forks source link

Onion spits out error when typing messages - Debian 11 #17

Open WinsDominoes opened 2 years ago

WinsDominoes commented 2 years ago

Hi ONION devs,

This morning, I was trying out the latest build of ONION from your CircleCI instance. When I started the server, everything went nicely. But when I typed into the chat, the console spits out this error.

2022-02-28 09:14:35,294 ERROR Orion [netty #2] Orion has encountered an exception: 
io.netty.handler.codec.DecoderException: java.lang.reflect.InvocationTargetException
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:477)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.reflect.InvocationTargetException: null
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at pro.prysm.orion.common.net.pipeline.PacketDecoder.decode(PacketDecoder.java:45)
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446)
    ... 29 common frames omitted
Caused by: java.lang.IllegalStateException: null
    at pro.prysm.orion.api.util.CollectorUtil.lambda$toSingleton$0(CollectorUtil.java:12)
    at java.base/java.util.function.Function.lambda$andThen$1(Function.java:88)
    at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:686)
    at pro.prysm.orion.server.Server.getPlayer(Server.java:182)
    at pro.prysm.orion.server.protocol.handler.play.PlayHandler.handle(PlayHandler.java:222)
    ... 36 common frames omitted

After typing 3 messages, I was kicked with the message "Invalid keep-alive ID". I couldn't remember the exact message.

Environment

Is there a possible fix for this? Or is it just because of my stupidity? Let's Go Brandon, Win's Cat

alexsobiek commented 2 years ago

It appears to be an issue with #getPlayer():

https://github.com/PrysmNetwork/Orion/blob/53817f1c1582b95d885e34306a65e1d4bdf75cd1/server/src/main/java/pro/prysm/orion/server/Server.java#L181-L183

Perhaps there wasn't a connection instance yet, though I'm not sure why that would be. I'll investigate this further :)