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

Adding and removing thousands of unique tags to an entity causes server to force shutdown

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.1 Hotfix
    • None
    • Confirmed
    • Windows
    • 1062166

      If you add a unique tag to an entity (a tag that has not been added to it before such as a random string of characters) and remove the tag from the previous tick every tick, the game will have progressively longer lag spikes and will eventually force the server to shutdown. This does not affect TPS generally.

      To replicate, have this JavaScript run in the entry point file of the scripting API (an easy way to generate unique tags):

      import {world, system} from '@minecraft/server';
      system.runInterval(() => {
          const players = world.getDimension("overworld").getPlayers();
          if (players.length == 0) return;
          const player = players[0];
          for (const tag of player.getTags()) player.removeTag(tag);
          player.addTag(`tag_${Math.random()}`);
      });

      With this running, the lag spikes began around 10-15 minutes into the test. Watchdog alerts will signal the lag spikes.

      Despite there only ever being one tag on the player at a time, the game appears to have a build-up of them until it just stops working altogether. From my testing, it seems combinations of multiple tags cause the same issue, even if there aren't thousands of unique tags, thousands of unique combinations cause similar lag spikes.

            Dominexis Dominexis
            Votes:
            4 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              CHK: