Chunk unloading problem in CraftBukkit

Discussion in 'Bukkit Discussion' started by bergerkiller, Sep 5, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    bergerkiller

    Just posting it here because the CraftBukkit devs don't seem to work on fixes for CraftBukkit (nms namespace)

    Anyhow, this is the situation:
    • A mapchunk51 packet with 0 length is sent to unload a chunk
    • The client responds to it by unloading the chunk
    • If you send this 0-length packet for a chunk that is not loaded/visible by the client, the client unloads the 0,0 (world coordinates) chunk
    • This results in a so-called 'world hole'
    Now the problem in CraftBukkit:
    • net.minecraft.server.PlayerInstance.b(EntityPlayer player)
    • It does not check if the chunk is visible by the player prior to sending an unload packet
    • When a player moves really quickly, faster than chunks can be received, it will hit a moment it will send an unload packet for a chunk that is not received
    • If the player is near 0,0, he will see a chunk hole occur
    I first thought it was caused by NoLagg, but isn't. NoLagg only increases the chance of this happening because it slows down chunk sending slightly. (and also the order, the chunks behind the player when walking are almost never sent)

    Can someone fix this? I am now writing up the 'hackish' way of fixing this, which is with about 6 reflection Field objects and a lot of hassle because of the invisible PlayerInstance class.

    Proposed fix:
    • If the player chunkCoordIntPairQueue (queue of chunks to send) contains THIS chunk, do not send the unload packet
    • Could be inserted in the netServerHandler, but not that needed. Is only called in the PlayerInstance function.
    Thanks.

    EDIT

    That may cause problems if the chunk is visible at the client but is being 're-sent' in the queue. Others often do that to refresh. Maybe an additional set of 'sent chunks' in the net server handler would be a good idea. (wasn't it there already?)
     
  2. Offline

    Killburner

    You lost me at 'mapchunk51 packet' (j/k). Is this inherent to the Minecraft server, Bukkit, or both? One reason I ask is that I haven't observed the chunk hole issue in quite some time (6-8 months perhaps).
     
  3. Offline

    Agent Wesker

    I believe I am experiencing this problem, would appreciate a fix.
     
  4. Offline

    bergerkiller

    Killburner
    (little late but I'll respond anyway)
    It is a bug in both. Minecraft should not unload the 0,0 chunk when the server tells it to unload a chunk it doesn't have. It should just ignore this request then.
    Neither should the server ask a client to unload a chunk it didn't send in the first place. But I guess that is something one can expect a server to do...

    IF someone is willing to look over the huge 'Minecraft bugs' WIKI article, click edit and add this tiny little 'programming error' in there, that would be great. I couldn't get my head around how this bug reporting worked, it looked like a huge coloured mess...
     
Thread Status:
Not open for further replies.

Share This Page