Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-174588

Chunks not unloading after player left when holding filled map

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.30.25 Preview, 1.20.15 Hotfix, 1.20.60, 1.20.80.20 Preview
    • None
    • Confirmed
    • Windows

      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.

            yhzx233 yhzx233
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: