minecraft/conn.go: replay RequestChunkRadius received before StartGame - #462
Open
RestartFU wants to merge 1 commit into
Open
minecraft/conn.go: replay RequestChunkRadius received before StartGame#462RestartFU wants to merge 1 commit into
RestartFU wants to merge 1 commit into
Conversation
A client that sends RequestChunkRadius after login completes but before StartGame() is called has the packet routed to the user read queue, so handleRequestChunkRadius never runs. The client then waits forever for ChunkRadiusUpdated and never sends SetLocalPlayerAsInitialised, leaving StartGame blocked. On a proxy the window between login and StartGame spans the downstream dial + handshake, making this easy to hit under load. Stash such a packet and replay it through handle() right after startGame(), which expects IDRequestChunkRadius at that point. The packet is still delivered to the user so proxies keep forwarding it downstream.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A client that sends
RequestChunkRadiusafter the login sequence completes but beforeStartGame()is called has the packet routed to the user read queue, sohandleRequestChunkRadiusnever runs. The client then waits forever forChunkRadiusUpdated, never sendsSetLocalPlayerAsInitialised, andStartGameblocks indefinitely — a deadlock with no timeout on either side.In a plain server this window is microseconds, but on proxies (which read packets from the accepted connection while dialing the downstream server) it spans the whole downstream dial + handshake, and some clients (observed with Android/console timing) send
RequestChunkRadiusearly enough to hit it.Fix: stash such a packet and replay it through
handle()right afterstartGame(), which expectsIDRequestChunkRadiusat that point. The packet is still delivered to the user read queue, so proxies that forward it downstream see no behavior change; servers that callStartGameimmediately are unaffected (the stash stays nil).