invoking retrieveCookie(NamespacedKey) with the same namespace twice deletes the first retrive from the map, resulting in kicks
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 12.7k
- Forks
- 3.5k
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
Expected behavior
When calling retrieveCookie(NamespacedKey) twice, both futures should be completed and the client should not be kicked.
Currently
@Override
public void handleCookieResponse(ServerboundCookieResponsePacket packet) {
if (this.paperConnection().handleCookieResponse(packet)) return; // Paper
this.disconnect(DISCONNECT_UNEXPECTED_QUERY, io.papermc.paper.connection.DisconnectionReason.INVALID_COOKIE); // Paper - kick event cause
}
kicks the player.
Because the second retrieveCookie call overrides the first because its a map, then when both cookies arrive the last one is not handled
https://github.com/PaperMC/Paper/blob/37dc5450d9b7acb2e367e8f1fbe0f07bb01334d9/paper-server/src/main/java/io/papermc/paper/connection/ReadablePlayerCookieConnectionImpl.java#L19
Observed/Actual behavior
Kick for Component.translatable("multiplayer.disconnect.unexpected_query_response")
Steps/models to reproduce
retriving the same cookie twice directly
Plugin and Datapack List
Paper version
latest
Other
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in paper-server/src/main/java/io/papermc/paper/connection/ReadablePlayerCookieConnectionImpl.java, then trace retrieveCookie(NamespacedKey) and handleCookieResponse(ServerboundCookieResponsePacket). Reproduce the case by retrieving the same cookie twice and verify that both futures complete without disconnecting the client for an unexpected query response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100