mojira.dev
MC-251889

io.netty.handler.codec.EncoderException when evaluating too many entity selectors in chat preview

The bug

When typing a command that causes the chat preview to respond with a message too large, the client disconnects from the server with an io.netty.handler.codec.EncoderException. This can be reproduced by preparing to send a command with a large number of entity selectors, such as /say @e @e @e @e @e @e @e @e @e @e in a normal world.

Relates to MC-251640.

How to reproduce

  1. Create a server in the latest affected version with chat preview enabled

  2. Join the server, and type the command /say @e @e @e ...
    ❌ Continuing to type @e will eventually cause client to disconnect

Stack trace

Error receiving packet 12
io.netty.handler.codec.EncoderException: String too big (was 313058 characters, max 262144)
	at qx.a(SourceFile:617) ~[server-1.19-pre1.jar:?]
	at qx.a(SourceFile:425) ~[server-1.19-pre1.jar:?]
	at qx.a(SourceFile:258) ~[server-1.19-pre1.jar:?]
	at te.a(SourceFile:16) ~[server-1.19-pre1.jar:?]
	at qz.a(SourceFile:45) ~[server-1.19-pre1.jar:?]
	at qz.encode(SourceFile:14) ~[server-1.19-pre1.jar:?]
	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[netty-codec-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:808) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at qv.a(SourceFile:213) ~[server-1.19-pre1.jar:?]
	at qv.b(SourceFile:205) ~[server-1.19-pre1.jar:?]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) [netty-common-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) [netty-common-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503) [netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [netty-common-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.76.Final.jar:4.1.76.Final]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Error receiving packet 12
io.netty.handler.codec.EncoderException: String too big (was 313058 characters, max 262144)
	at qx.a(SourceFile:617) ~[server-1.19-pre1.jar:?]
	at qx.a(SourceFile:425) ~[server-1.19-pre1.jar:?]
	at qx.a(SourceFile:258) ~[server-1.19-pre1.jar:?]
	at te.a(SourceFile:16) ~[server-1.19-pre1.jar:?]
	at qz.a(SourceFile:45) ~[server-1.19-pre1.jar:?]
	at qz.encode(SourceFile:14) ~[server-1.19-pre1.jar:?]
	at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[netty-codec-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:808) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) ~[netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at qv.a(SourceFile:213) ~[server-1.19-pre1.jar:?]
	at qv.b(SourceFile:205) ~[server-1.19-pre1.jar:?]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) [netty-common-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) [netty-common-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503) [netty-transport-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) [netty-common-4.1.76.Final.jar:4.1.76.Final]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.76.Final.jar:4.1.76.Final]
	at java.lang.Thread.run(Thread.java:833) [?:?]

Attachments

Comments 2

That's possible, although I wasn't able to reproduce that issue because it gave a "Failed to send chat message" error. Therefore, I assumed this one has a different cause.

[Mod] markderickson

gegy

Confirmed

Networking

1.19 Pre-release 1

1.19 Pre-release 2

Retrieved