mojira.dev
MC-271325

Server attempts to send disconnect packets in the status phase

Clients invalidly handling their connection during the status phase will cause a SocketException to be thrown, which is handled by the ClientConnection#exceptionCaught method. This results in a clientbound/minecraft:disconnect packet with the message 'Internal Exception: (stringified error)'to be sent to the client. However, this packet doesn't exist in the status phase, so the server logs the following exception:

Error sending packet clientbound/minecraft:disconnect
io.netty.handler.codec.EncoderException: Sending unknown packet 'clientbound/minecraft:disconnect'

I would expect this exception to not be thrown as sending a disconnect packet with text during the status phase makes no sense, and the true error is with the client rather than the server.

Linked issues

Attachments

Comments 34

I attached log-2024-05-01.txt, it goes along with this packet capture file that was too large for me to upload: https://drive.google.com/file/d/1l1RAHCC_-rwh8S2B1PO3YecRxdpyFvO0/view?usp=sharing

 

The issue happens at the times

[21:55:41] packet 11267
[23:46:39] packet 14259
[00:11:10] packet 14940
[00:13:02] packet 14990
[02:41:30] packet 18900
[04:47:41] packet 22144
[05:33:36] packet 23300

Affects 24w20a.

Affects 24w21b.

Affects 1.21 Pre-release 2.

Seems like this is breach attempt from old exploit. When older version, you might observed log that says something like <known player> disconnected from <not matching IP address>.

Seems like this is some kind of side effect of patching that exploit (or just updating java version). I experienced server crash when server processing these kind of errors.

24 more comments

occurs in 26.1.2. Mods I have that may affect networking: geyser, hydraulic, floodgate, krypton. This happens at random times, including when no one is online and no one is joining or leaving. I assume this is a result of bots trying to join/ping and hitting my whitelist

[08:38:29] [Netty NIO IO #2/ERROR]: Error sending packet clientbound/minecraft:disconnect
io.netty.handler.codec.EncoderException: Sending unknown packet 'clientbound/minecraft:disconnect'
	at knot//net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:50)
	at knot//net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:14)
	at knot//net.minecraft.network.PacketEncoder.encode$mixinextras$wrapped$9(PacketEncoder.java:26)
	at knot//net.minecraft.network.PacketEncoder.mixinextras$bridge$encode$mixinextras$wrapped$9$10(PacketEncoder.java)
	at knot//net.minecraft.network.PacketEncoder.md5bdc39$fabric-networking-api-v1$lambda$wrapWithContext$0$0(PacketEncoder.java:558)
	at java.base/jdk.internal.vm.ScopedValueContainer.runWithoutScope(ScopedValueContainer.java:112)
	at java.base/jdk.internal.vm.ScopedValueContainer.run(ScopedValueContainer.java:98)
	at java.base/java.lang.ScopedValue$Carrier.run(ScopedValue.java:466)
	at knot//net.minecraft.network.PacketEncoder.wrapMethod$baj000$fabric-networking-api-v1$wrapWithContext(PacketEncoder.java:558)
	at knot//net.minecraft.network.PacketEncoder.encode(PacketEncoder.java)
	at knot//net.minecraft.network.PacketEncoder.encode(PacketEncoder.java:12)
	at knot//io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107)
	at knot//io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:827)
	at knot//io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:752)
	at knot//io.netty.channel.ChannelOutboundHandlerAdapter.write(ChannelOutboundHandlerAdapter.java:113)
	at knot//net.minecraft.network.Connection$2.write(Connection.java:488)
	at knot//io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:827)
	at knot//io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:804)
	at knot//io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:869)
	at knot//io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1046)
	at knot//io.netty.channel.Channel.writeAndFlush(Channel.java:257)
	at knot//net.minecraft.network.Connection.doSendPacket(Connection.java:324)
	at knot//net.minecraft.network.Connection.sendPacket(Connection.java:316)
	at knot//net.minecraft.network.Connection.send(Connection.java:298)
	at knot//net.minecraft.network.Connection.send(Connection.java:292)
	at knot//net.minecraft.network.Connection.exceptionCaught(Connection.java:143)
	at knot//io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(AbstractChannelHandlerContext.java:289)
	at knot//io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(AbstractChannelHandlerContext.java:271)
	at knot//io.netty.channel.DefaultChannelPipeline$HeadContext.exceptionCaught(DefaultChannelPipeline.java:1396)
	at knot//io.netty.channel.DefaultChannelPipeline.fireExceptionCaught(DefaultChannelPipeline.java:890)
	at knot//io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.handleReadException(AbstractNioByteChannel.java:127)
	at knot//io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:179)
	at knot//io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.handle(AbstractNioChannel.java:445)
	at knot//io.netty.channel.nio.NioIoHandler$DefaultNioRegistration.handle(NioIoHandler.java:388)
	at knot//io.netty.channel.nio.NioIoHandler.processSelectedKey(NioIoHandler.java:596)
	at knot//io.netty.channel.nio.NioIoHandler.processSelectedKeysPlain(NioIoHandler.java:541)
	at knot//io.netty.channel.nio.NioIoHandler.processSelectedKeys(NioIoHandler.java:514)
	at knot//io.netty.channel.nio.NioIoHandler.run(NioIoHandler.java:484)
	at knot//io.netty.channel.SingleThreadIoEventLoop.runIo(SingleThreadIoEventLoop.java:225)
	at knot//io.netty.channel.SingleThreadIoEventLoop.run(SingleThreadIoEventLoop.java:196)
	at knot//io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:1193)
	at knot//io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at java.base/java.lang.Thread.run(Thread.java:1474)

Now running 26.2 and unlike previous version, didn’t saw one for 12 hours of use. Maybe is it unintentionally fixed?

It wasn’t fixed as 26.2

At least, so far, every exception thrown has matching recorded log with monitoring port 25565. Until last version, it sometimes throw those error without any TCP connection established but those kinds are not happening in 26.2 so far.

Guess from my comment two years ago, “Seems like this is breach attempt from old exploit. When older version, you might observed log that says something like <known player> disconnected from <not matching IP address>.” I think some modified clients like scanners send disconnect packet, and its player name field is not present, throwing such exception.

haykam

(Unassigned)

Community Consensus

Platform

Low

Networking

1.20.6, 24w20a, 24w21b, 1.21, 1.21.1, 1.21.2 Pre-Release 3, 1.21.4, 1.21.10, 1.21.11 Pre-Release 3

Retrieved