Fix NPE when bedrock HAProxy clientAddress is null#6429
Closed
lucas-santoro wants to merge 1 commit into
Closed
Conversation
After GeyserMC#6390 moved HAProxy handling into cloudburst-netty, RakServerChannel#getClientAddress can return null when no PROXY header has been cached for a sender. This happens on the first packet from a new sender, an expired session-cache entry, a malformed header, or a PROXY v2 LOCAL frame (which the upstream RakProxyServerHandler currently mishandles by passing null source addresses into InetSocketAddress). Geyser passed that null straight through to onConnectionRequest, where clientAddress.toString() threw NullPointerException and the connection was dropped with a noisy stack trace, leaving operators without a useful diagnostic. This change: - Adds an early null check in onConnectionRequest that rejects the connection cleanly and logs a WARN per occurrence when use-haproxy-protocol is enabled, pointing operators at the most likely upstream-proxy misconfiguration. RakNet's existing per-IP and global packet rate limiting (RAK_PACKET_LIMIT, DefaultRakServerThrottle) caps the realistic log rate. - Drops pings silently in RakPingHandler when no client address is resolved, so the server visibly appears offline instead of leaking the proxy's address to ping passthrough.
onebeastchris
approved these changes
May 24, 2026
Member
|
Hey, thanks for the PR! Packets without preceding proxy protocol header are already rejected, it's just that RakConnectionRequestHandler is put at first. The easiest fix would be to just move it before the RakServerOfflineHandler, like in #6436 This is also why it doesn't occur on ping, as ping is after the RakServerOfflineHandler |
Member
|
superseded by #6436 |
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.
After #6390 moved HAProxy handling into cloudburst-netty, RakServerChannel#getClientAddress can return null when no PROXY header has been cached for a sender. This happens on the first packet from a new sender, an expired session-cache entry, a malformed header, or a PROXY v2 LOCAL frame (which the upstream RakProxyServerHandler currently mishandles by passing null source addresses into InetSocketAddress).
Geyser passed that null straight through to onConnectionRequest, where clientAddress.toString() threw NullPointerException and the connection was dropped with a noisy stack trace, leaving operators without a useful diagnostic.
This change: