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

Having a lot of command block output results in lag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.21.1
    • None
    • Minecraft 1.21.1
      old:
      OS: Linux 6.8.0-41-generic x86_64 x86_64 x86_64 GNU/Linux
      JVM: openjdk 21.0.4 (build 21.0.4+7-Ubuntu-1ubuntu224.04, mixed mode, sharing)
      new:
      OS: Microsoft Windows 11 Pro
      JVM: openjdk 22
    • Confirmed
    • Performance

      Command blocks running commands for a lot of entities, or having a lot of command blocks producing some output will very quickly start lagging out the client or server. This seems to stem from the large amounts of log messages produced from the command blocks and does not happen with the commandBlockOutput gamerule disabled.

      It seems that this issue is more likely to occur on computers with lower configurations. If your computer is as good as my new one, you might need to throw several snowballs to reproduce the problem.

      Example steps to Reproduce:

      1. Position a loop command block and configure it to be always active.

      2. Input the first command: execute at @e[type=minecraft:snowball] run summon minecraft:item_display ~ ~ ~ {item:{id:'minecraft:diamond'},item_display:{gui:true}}

      • This is used as a simple way to increase the load/log spam from the next command block in a controlled way

      3. Place another loop command block and similarly configure it for perpetual activation.

      4. Enter the second command: execute as @e[type=minecraft:item_display] at @s run tp @s ~ ~ ~ facing entity %YOUR_NAME%

      • Remember to substitute `%YOUR_NAME%` with your actual Minecraft username.

      5. Throw a snowball.

      (If your computer is as good as my new one, you might need to throw several snowballs to reproduce the problem.)

      6. Observe the immediate freezing of the game.

        1. 44.3% CPU.png
          8 kB
          mrjiang32awa
        2. 2024-09-07-4.log.gz
          250 kB
          mrjiang32awa
        3. allay.png
          1.36 MB
          mrjiang32awa
        4. item_displays.png
          1.21 MB
          mrjiang32awa
        5. 1822 item_display.mp4
          3.40 MB
          mrjiang32awa
        6. freeze on linux.mp4
          3.78 MB
          mrjiang32awa
        7. 1865 allaies.mp4
          4.91 MB
          mrjiang32awa

            Unassigned Unassigned
            mrjiang32awa mrjiang32awa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: