Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-148494

Summoned entities in "ticking" chunks do not despawn, causing resource leak

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.14 Pre-Release 3, Minecraft 1.14.2, 1.15 Pre-Release 2, 1.17.1, 21w38a, 1.18.1, 22w03a, 1.20.6, 24w21b
    • None
    • Confirmed
    • Entities, Performance

      It is possible to force the generation of persistent entities by summoning them into "ticking" chunks. These entities will not despawn on their own.

      This can be seen by summoning entities at the location of other entities within "ticking" chunks. Such entities will persist in memory and can accumulate. This can eventually cause lag and possible crashes if the command is invoked repeatedly because the number of entities grows exponentially.

      To reproduce:
      1. Create a superflat world.
      2. Set the time to eternal night so hostile mobs spawn.
      3. Move about 4 chunks from spawn in each direction and return to spawn.
      4. Run the following command: `/execute at @e[type=!player] run summon minecraft:evoker_fangs`
      5. Run the following command: `/kill @e[type=minecraft:evoker_fangs]` - this sometimes removes evoker fangs, proving they are not removed automatically. Expected outcome for kill command: "no entity was found".

      To see the leak, run step 4 several times.

      Examples demonstrating exponential growth:

      • running step 4 once before killing the evoker_fangs entities removed 6 entities
      • running step 4 twice removed 18 entities
      • running step 4 10 times removed 6138 entities
      • running step 4 14 times removed 98298 entities and the lag was noticeable

            Unassigned Unassigned
            bdm68 bdm68
            Votes:
            13 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              CHK: