mojira.dev
MCPE-174588

Chunks not unloading after player leaves while holding filled map

After a player left the game while holding a filled map, the chunks within a 17x17 chunk radius of the player's location are not unloaded. This issue can be observed when executing the command "/testfor @e" as entities within that specific area are still detectable.

 

After decompiling the code, I discovered that the issue stems from the fact that the MapItemSavedData retains the MapItemTrackedActor representing the player, and this representation is never removed, even after the player left the game. Additionally, within this context, the MapItemTrackedActor also holds a reference to the ChunkViewSource. This ChunkViewSource maintains a GridArea<shared_ptr<LevelChunk>> of a size of 17x17 chunks, contributing to reference counts that prevent the proper destruction of LevelChunk objects.

Steps to Reproduce:

(In BDS)

  1. Start a BDS.

  2. Join the server.

  3. Leave the game.

  4. Execute "/testfor @e" in console.

  5. Join the server again.

  6. Hold a filled map.

  7. Leave the game.

  8. Execute "/testfor @e" in console.

(Locally)

  1. Start a multiplayer game.

  2. Have the host execute the command, standing in the Overworld at coordinates (0, 0), playing the role of the BDS as mentioned in the previous context.

  3. Have a second player join the game, standing in the Overworld at coordinates (1000, 1000) (ensuring no overlap with the host's position), playing the role of the player mentioned earlier.

  4. Perform the same sequence of actions as described earlier, with the only difference being that the host executes the commands instead of the console. You should observe the same results as with the BDS scenario.

Observed Results:
The first "/testfor @e" command shows "No targets matched selector" while the second one has entities.

Expected Results:
The expected outcome is that neither of the "/testfor @e" commands should have any targets, in both cases.

Notes:
This issue is triggered whenever a player takes out a filled map during a game session. Please ensure that no one has this item in their inventory before proceeding with the first step.

This bug is distinct from MCPE-77266. In MCPE-77266, entities can unload correctly after a player exits, and only entities near the player's joined area fail to unload before the player exits.

Comments 9

Hi

Does this issue only occur on Bedrock Dedicated Server or it can be reproduced on local worlds/Realms?

This ticket will automatically reopen when you reply.

Hi

Does this issue only occur on Bedrock Dedicated Server or it can be reproduced on local worlds/Realms?

This ticket will automatically reopen when you reply.

I have tested this locally in multiplayer mode, and it can be reproduced.

I have tested this locally in multiplayer mode, and it can be reproduced.

Have you tried this without holding a map? It sounds like MCPE-77266--entities and chunks are never unloaded until the entire dimension is unloaded.

If you are sure this is a different issue from MCPE-77266, then please update your Steps to Reproduce to clarify how many players are needed and in what dimensions and coordinates they should be and what order they should join and exit the world, to demonstrate the bug.

Thank you for your report!

However, this issue has been temporarily closed as Awaiting Response.

Is this still an issue in the latest version? If yes, could you please add it to the affected versions (or mention it if you are not the reporter)?

This ticket will automatically reopen when you reply.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📓 Project Summary – 📧 Suggestions – 📖 Minecraft Wiki

This can still be reproduced with BDS. I have not tried reproducing this locally.

yhzx233

(Unassigned)

1420366

Confirmed

Windows

1.20.30.25 Preview, 1.20.15 Hotfix, 1.20.60, 1.20.80.20 Preview, 1.21.60.28 Preview

Retrieved