Geyser icon indicating copy to clipboard operation
Geyser copied to clipboard

Disconnect when a player has a large number of advancements

Open aloki opened this issue 2 months ago • 9 comments

Describe the bug

Players are disconnected from the server upon entering the world if they have a large number of advancements:

[Geyser-Spigot] Подключен игрок с именем пользователя SchiVoid
[Geyser-Spigot] SchiVoid (вошёл как: SchiVoid) подключился к серверу Java
[floodgate] Игрок Riden_Folt (UUID: ab2252c7-b49f-302f-80c6-39ed0782db5b) присоединился используя Floodgate
Riden_Folt joined the game
Riden_Folt[/x.x.x.x:0] logged in with entity id 524 at ([world]2234.6584717857563, 64.0, -13814.29792655613)
[floodgate] Игрок Riden_Folt вошедший через Floodgate отключился
[Geyser-Spigot] SchiVoid отключился от сервера Java по причине Internal Exception: io.netty.handler.codec.EncoderException: Packet too large: size 3802133 is over 8
Riden_Folt lost connection: Internal Exception: io.netty.handler.codec.EncoderException: Packet too large: size 3802133 is over 8
Riden_Folt left the game

To Reproduce

  1. Add a datapack with a large number of advancements to the world, for example https://modrinth.com/datapack/all-tropical-fish-datapack/version/5.
  2. Grant the player a certain number of advancements (each advancement contains 289 child advancements): advancement grant Player from tropicalfish:betty/main advancement grant Player from tropicalfish:blockfish/main advancement grant Player from tropicalfish:brinely/main advancement grant Player from tropicalfish:clayfish/main advancement grant Player from tropicalfish:dasher/main advancement grant Player from tropicalfish:flopper/main advancement grant Player from tropicalfish:glitter/main advancement grant Player from tropicalfish:kob/main advancement grant Player from tropicalfish:snooper/main advancement grant Player from tropicalfish:spotty/main or: advancement grant Player from minecraft:recipes/root advancement grant Player from tropicalfish:betty/main advancement grant Player from tropicalfish:blockfish/main advancement grant Player from tropicalfish:brinely/main advancement grant Player from tropicalfish:clayfish/main advancement grant Player from tropicalfish:dasher/main advancement grant Player from tropicalfish:flopper/main advancement grant Player from tropicalfish:glitter/main advancement grant Player from tropicalfish:kob/main or just: advancement grant Player everything

This is enough for an error to occur and make it impossible to enter the world.

Expected behaviour

There should be no errors. Or is the Bedrock client working as intended and not supporting a large number of advancements for the player?

Screenshots / Videos

No response

Server Version and Plugins

No response

Geyser Dump

https://dump.geysermc.org/mGz515VC5mYzircg9Hbx4yTqBAZfGVlr

Geyser Version

2.8.4-b944 (git-master-71803c0)

Minecraft: Bedrock Edition Device/Version

No response

Additional Context

No response

aloki avatar Oct 02 '25 20:10 aloki

please assign this issue to me

namanONcode avatar Oct 04 '25 12:10 namanONcode

You can work on the issue without assignment, just make a PR and reference the issue

Novampr avatar Oct 04 '25 13:10 Novampr

The error indicates a Netty packet size limit issue (default 8MB) during account linking, likely due to oversized data transfer (e.g., player inventory, session cache, or world chunks) between Bedrock and Java sides.

namanONcode avatar Oct 07 '25 04:10 namanONcode

I found the issue! The problem is in the JavaLevelChunkWithLightTranslator.java file where chunk data is being sent to Bedrock clients. When the payload size exceeds Minecraft's protocol limit, it causes the "Packet too large" error.

namanONcode avatar Oct 07 '25 04:10 namanONcode

@aloki @Novampr I found the root cause of the issue! The problem was in JavaLevelChunkWithLightTranslator.java, where chunk data was being sent to Bedrock clients. When the payload size exceeded Minecraft’s protocol limit, it triggered the "Packet too large" error.

🛠️ Fix Summary

Added a validation check to ensure that no chunk packet exceeds the 8 MB protocol limit. If a chunk packet is too large, it’s skipped to prevent client disconnections.

Pull Request : https://github.com/GeyserMC/Geyser/pull/5887

💻 Code Snippet

// Validate packet size to prevent "Packet too large" errors
// Minecraft protocol has a default limit of 8MB (8,388,608 bytes)
final int MAX_PACKET_SIZE = 8_388_608; // 8MB
if (payload.length > MAX_PACKET_SIZE) {
    session.getGeyser().getLogger().error(
        "Chunk packet too large for player " + session.getPlayerEntity().getUsername() +
        " at coordinates (" + packet.getX() + ", " + packet.getZ() + ")" +
        ": size " + payload.length + " bytes exceeds limit of " + MAX_PACKET_SIZE + " bytes. " +
        "This chunk contains " + bedrockBlockEntities.size() + " block entities and " +
        sectionCount + " sections. Consider reducing custom skulls, holograms, or complex block entities in this area."
    );

    // Log debug information if debug mode is enabled
    if (session.getGeyser().getConfig().isDebugMode()) {
        session.getGeyser().getLogger().debug(
            "Chunk details - X: " + packet.getX() +
            ", Z: " + packet.getZ() +
            ", Block entities: " + bedrockBlockEntities.size() +
            ", Section count: " + sectionCount +
            ", Payload size: " + payload.length
        );
    }

    // Skip sending this oversized packet to prevent disconnection
    return;
}

namanONcode avatar Oct 07 '25 04:10 namanONcode

That is not the fix for the issue, AI can't help you there

@aloki i'd recommend trying these steps to find the plugin that's causing this: If you have a possible plugin interfering with Geyser or Floodgate, follow these steps to find the culprit plugin:

  • Temporarily remove/move half of your plugins from your server's plugins folder.
  • If the problem persists, remove another half.
  • If the problem goes away, swap that half of your plugins with the other half.
  • Keep repeating this pattern, this time with the half that exhibits the problem, until you find your problematic plugin.

Thanks!

onebeastchris avatar Oct 08 '25 20:10 onebeastchris

@onebeastchris Nothing helps. I disabled all plugins, leaving only Geyser and Floodgate. I removed all items from my character's inventory. I teleported to different locations in the overworld and even to other dimensions. The errors were reported by another player in the first message. Now I have reproduced the error on my accounts. What else can be checked?

aloki avatar Oct 09 '25 13:10 aloki

Please send a full latest.log via mclo.gs showing this error occurring on a setup with just Geyser+Floodgate

onebeastchris avatar Oct 09 '25 13:10 onebeastchris

I found the cause of the bug and edited the first message.

aloki avatar Oct 09 '25 19:10 aloki