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

ProtocolLib + ViaVersion incompatibility on NachoSpigot 1.8 #325

Closed
MWHunter opened this issue Apr 13, 2022 · 30 comments
Closed

ProtocolLib + ViaVersion incompatibility on NachoSpigot 1.8 #325

MWHunter opened this issue Apr 13, 2022 · 30 comments
Labels
bug Something isn't working

Comments

@MWHunter
Copy link
Collaborator

First join on a 1.18 player:
[18:23:29] [Server thread/INFO]: [GrimAC] Netty pipeline is: [timeout, splitter, pe-decoder-grimac, decompress, decoder, protocol_lib_inbound_interceptor, prepender, encoder, protocol_lib_wire_packet_encoder, pe-encoder-grimac, packet_handler, DefaultChannelPipeline$TailContext#0]

The result is a ton of exceptions thrown

Second join on a 1.18 player:
[18:23:41] [Server thread/INFO]: [GrimAC] Netty pipeline is: [timeout, splitter, decompress, decoder, protocol_lib_inbound_interceptor, prepender, compress, encoder, protocol_lib_wire_packet_encoder, pe-encoder-grimac, packet_handler, DefaultChannelPipeline$TailContext#0]

First join on a 1.8 player:
[18:25:14 INFO]: [GrimAC] Netty pipeline is: [timeout, splitter, pe-decoder-grimac, decoder, protocol_lib_inbound_interceptor, prepender, encoder, protocol_lib_wire_packet_encoder, pe-encoder-grimac, packet_handler, DefaultChannelPipeline$TailContext#0]

@MWHunter MWHunter added the bug Something isn't working label Apr 13, 2022
@retrooper
Copy link
Owner

Can't reproduce? Did you make sure Grim soft-depends ViaVersion? That might be the cause.

@retrooper
Copy link
Owner

Works perfectly fine on latest commit on a 1.8 spigot server with current latest Via dev build & ProtocolLib dev build.

@Hyronymos1337
Copy link

Hyronymos1337 commented Apr 14, 2022

Still happens for me with newest compiled grim with latest packetevents

https://paste.twerion.net/upeyumejot.makefile

@MWHunter
Copy link
Collaborator Author

That paste has lpx enabled, I'm unsure what lpx does but it's likely a separate issue.

@Hyronymos1337
Copy link

@MWHunter
Copy link
Collaborator Author

Still an issue

@retrooper
Copy link
Owner

Floodgate incompatibility?

@retrooper
Copy link
Owner

@lordhadow1 can you try removing Floodgate, I'll try setting Floodgate up soon to see what is up.

@retrooper
Copy link
Owner

I don't see how this is still an issue. Works fine for me.

@Hyronymos1337
Copy link

here a log without floodgate: https://paste.twerion.net/yuwucevunu.makefile

@Hyronymos1337
Copy link

@Hyronymos1337
Copy link

Hyronymos1337 commented Apr 19, 2022

spigot.yml late-bin: true fixes it

new errors: https://paste.twerion.net/qazurubuve.makefile

@MWHunter
Copy link
Collaborator Author

Minimally reproducable without late bind, with only ViaVersion and PacketEvents 2.0

You have to join with a 1.18 client on a 1.8 server while the server is starting - meaning during the time that plugins are loading. Late bind must be disabled to reproduce this.

@MWHunter
Copy link
Collaborator Author

Potentially fixed on fed8b95

https://cdn.discordapp.com/attachments/811396971059085364/966122886882549800/grimac-2.2.7-all.jar is a grim jar with this update if any who has had this issue wants to see if it still occurs.

@Hyronymos1337
Copy link

now you can join, but sometimes only at the 2nd try

@MWHunter
Copy link
Collaborator Author

When it breaks:
[02:03:21] [Server thread/INFO]: [GrimAC] Netty pipeline is: [timeout, splitter, pe-decoder-grimac, decompress, decoder, protocol_lib_inbound_interceptor, prepender, compress, encoder, protocol_lib_wire_packet_encoder, pe-encoder-grimac, packet_handler, DefaultChannelPipeline$TailContext#0]

When it works:
[02:03:29] [Server thread/INFO]: [GrimAC] Netty pipeline is: [timeout, splitter, decompress, decoder, protocol_lib_inbound_interceptor, prepender, compress, encoder, protocol_lib_wire_packet_encoder, pe-encoder-grimac, packet_handler, DefaultChannelPipeline$TailContext#0]

I don't know how to fix this or what PacketEvents is even trying to do here. But my guess is that PacketEvents 2.0 is somehow getting in front of ViaVersion.

@MWHunter
Copy link
Collaborator Author

Can we just try to debug the ViaVersion being delayed in returning client version instead of hacking around ViaVersion and creating a temporary injector just to grab the client version?

Or at the very least make it so that the temporary injector will automatically disable itself while in the PLAY state.

@retrooper
Copy link
Owner

Or wait for me to fix the issue. Been a while since I tested my 1.8 server without late-bind. But I see no issue in keeping your server with "late-bind" enabled (atleast for now)

@MWHunter
Copy link
Collaborator Author

Potentially related to double injecting, as I've noticed that it's possible for the injector to inject twice on 1.8.

@MWHunter
Copy link
Collaborator Author

This occurs 100% consistently with NachoSpigot, but I've yet to encounter this with paper 1.8. More testing is needed!

The root cause seems to be from a failure to move the decoder (serverbound packet processor) in time, corrupting the player's pipeline and throwing a bunch of exceptions in the process. Here is some debug info from the exact moment this exception gets thrown in the pipeline and the player gets kicked.

throw new PacketProcessException("Failed to map the Packet ID " + packetID + " to a PacketType constant. Bound: " + packetSide.getOpposite() + ", Connection state: " + user.getConnectionState() + ", Server version: " + serverVersion.getReleaseName());

This gets thrown.

[15:58:28 INFO]: [ViaVersion] ViaVersion detected server version: 1.8.x (47)
[15:58:28 WARN]: [ViaVersion] This version of Minecraft is extremely outdated and support for it has reached its end of life. You will still be able to run Via on this Minecraft version, but we are unlikely to provide any further fixes or help with problems specific to legacy Minecraft versions. Please consider updating to give your players a better experience and to avoid issues that have long been fixed.
[15:58:28 INFO]: [ViaVersion] Finished mapping loading, shutting down loader executor!
[15:58:28 WARN]: [ViaVersion] You are running a newer version of the plugin than is released!
[15:58:28 INFO]: [packetevents] Processed 127.0.0.1:54181's client version. Client Version: 1.18.2
[15:58:28 INFO]: [packetevents] Transitioned 127.0.0.1:54181 into the LOGIN state!
[15:58:28 INFO]: [ViaVersion] Using FastUtil Long2ObjectOpenHashMap for block connections
[15:58:28 INFO]: UUID of player DefineOutside is 2e9cb685-6f99-3682-9f22-d0d74bd9fee1
[15:58:28 INFO]: [packetevents] Requested ViaVersion for DefineOutside's protocol version. Protocol version: -1
[15:58:28 INFO]: [GrimAC] Netty pipeline is: [timeout, splitter, pe-decoder-grimac, decoder, protocol_lib_inbound_interceptor, prepender, encoder, protocol_lib_wire_packet_encoder, pe-encoder-grimac, packet_handler, DefaultChannelPipeline$TailContext#0]
[15:58:28 INFO]: DefineOutside[/127.0.0.1:54181] logged in with entity id 321 at ([world]58.18808514997341, 85.0, 243.13198740243033)
We have hit a breakpoint now in the server execution log, on the first exception thrown

This is the netty pipeline while the user's connection state is PLAY. The packet ID is 29, which is the serverbound PING packet.

[timeout, splitter, decompress, pe-decoder-grimac, decoder, protocol_lib_inbound_interceptor, prepender, compress, pe-encoder-grimac, encoder, protocol_lib_wire_packet_encoder, packet_handler, DefaultChannelPipeline$TailContext#0]

The decoder is getting in front of viaversion. I'll do more debugging on why it isn't moving in front of viaversion in time causes packetevents to read serverbound packets in the wrong protocol format.

@MWHunter
Copy link
Collaborator Author

PacketEvents just doesn't see the LOGIN_SUCCESS packet... I've debugged the client and it is getting the packet, but PacketEvents just entirely misses the packet. I don't know how NachoSpigot managed to accomplish this.

Can confirm that it works perfectly with 1.8.

@Sculas
Copy link

Sculas commented Apr 22, 2022

I don't know how NachoSpigot managed to accomplish this.

I'd love to know too, haha.

@retrooper
Copy link
Owner

So can we get this straight, is this only happening on NachoSpigot?

@retrooper
Copy link
Owner

If so, can you make the issue name more accurate. Or else I assume its broken on an ordinary Spigot server, I personally do not use NachoSpigot.

@MWHunter MWHunter changed the title ProtocolLib + ViaVersion incompatibility on 1.8 server ProtocolLib + ViaVersion incompatibility on NachoSpigot 1.8 Apr 24, 2022
@MWHunter
Copy link
Collaborator Author

There was multiple issues, the original was a late bind issue and the current issue is a NachoSpigot issue. Both had identical stack traces.

@retrooper
Copy link
Owner

Fixed?

@Hyronymos1337
Copy link

No, if you know how to fix it, go ahead, nacho devs doesnt know what they are doing

@MWHunter
Copy link
Collaborator Author

Well, nacho is dead. That fixes it, I guess.

@Hyronymos1337
Copy link

yes, packetevents works on forks of nachospigot like windspigot

@MWHunter
Copy link
Collaborator Author

Yeah they have https://github.com/Wind-Development/WindSpigot/blob/master/WindSpigot-Server/src/main/java/io/papermc/paper/network/ChannelInitializeListenerHolder.java

I'm just going to close the issue. There's been too many things discussed here for it to be useful. WindSpigot and PandaSpigot will both support PacketEvents.

We aren't adding support for modern netty versions on 1.8, these forks just need to add the paper injector API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants