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

check packet to be queued for unsafe#sendPacket for all client with version >= 1.20.2 #3582

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Outfluencer
Copy link
Contributor

This change makes it much easier for all developers to send packets in the newer versions as the sendPacketQueued is not implemented via api and can only be called with reflections if we use only api.

All in all the change should make the networking more safe for further changes and implementation of new api.
And could indirectly fix problems with bad plugins that have not been specially updated for the new networking behaviour

@NEZNAMY
Copy link

NEZNAMY commented Dec 20, 2023

Has this been tested? Method sendPacketQueued calls unsafe().sendPacket and with this PR unsafe().sendPacket will call sendPacketQueued for all 1.20.2+ players, causing and endless loop.

@Outfluencer
Copy link
Contributor Author

oh i forgot something you are right xd

@Outfluencer
Copy link
Contributor Author

thank you @NEZNAMY

@Outfluencer
Copy link
Contributor Author

Outfluencer commented Dec 20, 2023

okay i tested it, it works fine now

@Outfluencer
Copy link
Contributor Author

This PR should also fix this exception i encountert lately

io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: Cannot get ID for packet class net.md_5.bungee.protocol.packet.TabCompleteResponse in phase CONFIGURATION with direction TO_CLIENT at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881) at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:940) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:966) at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:934) at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1020) at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:311) at net.md_5.bungee.netty.ChannelWrapper.write(ChannelWrapper.java:104) at net.md_5.bungee.UserConnection$1.sendPacket(UserConnection.java:149) at net.md_5.bungee.connection.UpstreamBridge.handle(UpstreamBridge.java:352) at net.md_5.bungee.protocol.packet.TabCompleteRequest.handle(TabCompleteRequest.java:87) at net.md_5.bungee.netty.HandlerBoss.channelRead(HandlerBoss.java:138) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) 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:788) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) 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.IllegalArgumentException: Cannot get ID for packet class net.md_5.bungee.protocol.packet.TabCompleteResponse in phase CONFIGURATION with direction TO_CLIENT at com.google.common.base.Preconditions.checkArgument(Preconditions.java:463) at net.md_5.bungee.protocol.Protocol$DirectionData.getId(Protocol.java:808) at net.md_5.bungee.protocol.MinecraftEncoder.encode(MinecraftEncoder.java:26) at net.md_5.bungee.protocol.MinecraftEncoder.encode(MinecraftEncoder.java:10) at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ... 47 more 22:18:13 [INFORMATION] [spvde_] disconnected with: EncoderException : java.lang.IllegalArgumentException: Cannot get ID for packet class net.md_5.bungee.protocol.packet.TabCompleteResponse in phase CONFIGURATION with direction TO_CLIENT @ io.netty.handler.codec.MessageToByteEncoder:125

@Outfluencer
Copy link
Contributor Author

the exception occours when player is tab completing while he is sent to another server

@md-5
Copy link
Member

md-5 commented Jan 3, 2024

Packet queing is a sledgehammer that masks bugs. In the tab complete example isn't that suggesting the player would receive tab results from the wrong server?

@Outfluencer
Copy link
Contributor Author

Packet queing is a sledgehammer that masks bugs. In the tab complete example isn't that suggesting the player would receive tab results from the wrong server?

Yes it is, but at least the player would not cause exceptions and would not get kicked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants