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

[🐞]: mod_version_check_packet breaks Velocity proxy support #592

Closed
4 tasks done
Sander0542 opened this issue Aug 22, 2024 · 6 comments
Closed
4 tasks done

[🐞]: mod_version_check_packet breaks Velocity proxy support #592

Sander0542 opened this issue Aug 22, 2024 · 6 comments
Labels
1.20.1-FORGE Minecraft Version bug Something isn't working

Comments

@Sander0542
Copy link

Before Continuing:

  • Always check you are using the latest version of the mods and its dependencies
  • Remove mod that enhances Minecraft: Optifine, Sodium, others. The issue still persists.
  • If you are unsure which mod is the culprit.
    Disable all of your mods and enable them 1-2 mods each time to isolate the culprit
  • Confirm that there is no existing issue with a similar description submitted in the list of issues.

Version

1.20.1

Loader

Forge

EveryCompat Version

everycomp-1.20-2.6.66

Moonlight Lib Version

moonlight-1.20-2.12.6-forge

Issue with mods

Velocity 3.0.0

This is not another mod, but a minecraft server proxy.

Issue Detail

When the mod_version_check_packet setting is enabled, this mod sends a packet to the server to query the correct versions. This packet contains the Integer.MIN_VALUE which causes the proxy to disconnect the client.

The following section of code causes the client to disconnect

@SubscribeEvent
public void onPlayerNegotiation(PlayerNegotiationEvent playerNegotiationEvent) {
if(ModConfigs.CHECK_PACKET.get()) {
((ChannelHandlerImpl) ECNetworking.CHANNEL).channel.sendTo(new ECNetworking.S2CModVersionCheckMessage(),
playerNegotiationEvent.getConnection(),
NetworkDirection.LOGIN_TO_CLIENT
);
}

More information can be found in the following ticket: PaperMC/Velocity#1370

OPTIONAL: Latest.log | Crash-report Attachment

The following log comes from the Velocity proxy, not the mod.

[20:18:40] [Netty epoll Worker #1/ERROR] [com.velocitypowered.proxy.connection.MinecraftConnection]: [server connection] Sander0542 -> valhelsia6: exception encountered in org.adde0109.ambassador.velocity.backend.ForgeLoginSessionHandler@e1cc3f2
io.netty.handler.codec.CorruptedFrameException: Error decoding class com.velocitypowered.proxy.protocol.packet.LoginPluginMessagePacket Direction CLIENTBOUND Protocol 1.20 State LOGIN ID 4
	at com.velocitypowered.proxy.protocol.netty.MinecraftDecoder.handleDecodeFailure(MinecraftDecoder.java:130) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at com.velocitypowered.proxy.protocol.netty.MinecraftDecoder.tryDecode(MinecraftDecoder.java:85) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at com.velocitypowered.proxy.protocol.netty.MinecraftDecoder.channelRead(MinecraftDecoder.java:60) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at java.base/java.lang.Thread.run(Unknown Source) [?:?]
Caused by: io.netty.handler.codec.CorruptedFrameException: Bad VarInt decoded
	at com.velocitypowered.proxy.protocol.ProtocolUtils.readVarInt(ProtocolUtils.java:132) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at com.velocitypowered.proxy.protocol.packet.LoginPluginMessagePacket.decode(LoginPluginMessagePacket.java:66) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	at com.velocitypowered.proxy.protocol.netty.MinecraftDecoder.tryDecode(MinecraftDecoder.java:83) ~[velocity-3.3.0-SNAPSHOT-400.jar:3.3.0-SNAPSHOT (git-9d25d309-b400)]
	... 24 more

OPTIONAL: To Produce

  1. Configure Velocity and the backend Forge server.
  2. Connect to the proxy server, which forwards the connection to the backend Forge server.
  3. Get disconnected because of an invalid packet.
@Sander0542 Sander0542 added the bug Something isn't working label Aug 22, 2024
@Xelbayria
Copy link
Collaborator

U need to update your EveryComp to the latest version, v2.6.72 & Moonlight Lib to v2.12.14.
Try test them to see if the issue persist.

@Xelbayria Xelbayria added the 1.20.1-FORGE Minecraft Version label Aug 22, 2024
@MehVahdJukaar
Copy link
Owner

Hm what? Integer min value where? That packet works and thus must be valid for vanilla so I don't see how it could be our issue.
The packet contains a map of strings and map encoding is done by vanilla code. If there's any integer is there. Rest is strings.

public S2CModVersionCheckMessage(FriendlyByteBuf buf) {

@Xelbayria
Copy link
Collaborator

Any news on this issue?

@456dev
Copy link

456dev commented Sep 12, 2024

the int here is message id: see https://wiki.vg/Protocol#Login_Plugin_Request
this here is filled in by forge in the internals of the simple network channel as int.minvalue as a getter is not provided on creation.

while int.min value is a valid value for it, it shouldnt occur in normal gameplay (as the docs say it should be unique vs all other messages).

int.min value was previously treated as a sentinel value for parsing error in velocity, and is fixed as of build 416, released ~20 days ago

i think the correct way of doing it is with the loginIndexGetter and loginIndexSetter on SimpleChannel.MessageBuilder, but there is very little docs

@MehVahdJukaar
Copy link
Owner

MehVahdJukaar commented Sep 12, 2024

I still dont know where this -1 would be in my code.
If you mean its in the message id its not. Those message have Ids 0 and 1.
An also even if they were to use a negative or -1 value, if forge allowed it would still be a velocity issue. If forge allows the packet then its not my issue

@Xelbayria
Copy link
Collaborator

Closing this since no replying.

you can re-open if you still get the same issue as above.

@Xelbayria Xelbayria closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.20.1-FORGE Minecraft Version bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants