-
Bug
-
Resolution: Fixed
-
24w07a
-
None
-
Plausible
-
Networking
-
Important
-
Platform
Hello, there is a tricky race condition in the latest snapshot, due to the server-side handling of `ServerboundFinishConfigurationPacket`. The packet is terminal, which causes the connection to become unbound immediately when it is received. It is then queued for processing on the main thread, which will eventually setup the outbound GAME protocol. In the meanwhile, it can happen that a keep alive packet is sent to the client, causing an immediate disconnection due to
Exception caught in connection io.netty.handler.codec.EncoderException: Pipeline has no outbound protocol configured, can't process packet net.minecraft.network.protocol.common.ClientboundKeepAlivePacket@611a8815
For a more step-by-step explanation of the issue:
- server receives ServerboundFinishConfigurationPacket on the netty thread and immediately disables its outbound protocol
- netty thread calls handleConfigurationFinished, which enqueues itself for processing on the main thread
- if unlucky: the main thread sends a ClientboundKeepAlivePacket
- then the main executor would normally process handleConfigurationFinished and configure the protocol, but it's too late - the packet is already sent
The issue can be reproduced by adding the following code at the end of JoinWorldTask#start:
try { Thread.sleep(15000); } catch (InterruptedException e) { throw new RuntimeException(e); }
I have created a 24w07a Fabric mod that does exactly this, you can find it at https://github.com/Technici4n/MC-268727-repro.
- links to