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

Lag increases over time when you repeatedly light and break nether portals, related to memory leak


    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • None
    • 1.19.50, 1.19.51
    • None
    • Confirmed
    • Windows
    • 944843

      When a nether portal is repeatedly lit and broken, nearby players (and possibly whole servers, which I have not tested) can experience increasing amounts of "lag". The lag includes

      • FPS drops
      • choppy movement
      • visual updates skipped (such as for redstone dust and portal tiles)
      • delayed world interaction (such as breaking blocks or flipping levers)

      After a period of time the lag becomes so bad that a permanent loading bar appears and the situation is unrecoverable. The player is still able to move, but cannot break or toggle blocks and cannot open the world menu to exit. It looks like this: Unrecoverable portal lag.mp4 If the contraption is shut off before the point of no return, left off for a long time, and then turned on again, the the lag returns at the same level it was at when the contraption was last run. The only way to reset the built-up lag level is to exit the world.

      The lag seems to correlate with a memory leak. Lighting and breaking 1 portal every 8 gt corresponded with the following memory usage as shown by Resource Monitor in Windows (amounts are in MB):

      time Committed Working Shareable Private
      baseline 767 611 103 507
      1:00 787 628 103 524
      2:00 792 633 103 537
      3:00 802 640 103 541
      4:00 813 649 103 549
      5:00 825 660 103 563
      10:00 879 710 104 611

      Steps to reproduce

      1. Load Portal research.mcworld. The world consists of two nether portals with contraptions that repeatedly light and break them. The lighting is done by flint & steel and the breaking is done by dispensers placing water. The redstone is set up to break each portal once every 8 game ticks. The contraption must be shut off when you exit the world or else it will likely break when reloaded. Mob spawning is off to test lag specifically caused by the portals. (There are water trays to carry zombie pigmen if mob spawning is turned on because I had originally built this structure to test gold farm storage.) 
      2. Flip the lever at 20, 212, -30 and start a stopwatch.
      3. After a few minutes, start moving around the portals to check on choppiness, or check an FPS meter.
      4. When lag becomes noticeable, flip the lever to shut off the portals.
      5. Move around and/or check FPS.
      6. Flip the lever again.

      Expected results

      The portals break and re-light without generating lag. Or, if the build does generate lag, the lag is steady and just slows down the game. In step 5 there is no lag, and in step 6 the lag is only as bad as it was shortly after flipping the lever the first time in step 2.

      Observed results

      Lag increases over time. In step 5 there is no lag, but in step 6 the lag immediately returns to how bad it was just before flipping the lever off in step 4, even if you wait a very long time. If you let the contraption continue to run, the game eventually becomes unrecoverable with a permanent loading bar and the player being unable to flip the lever, break a portal frame, or open the menu to exit.

            GoldenHelmet [Mod] GoldenHelmet
            15 Vote for this issue
            5 Start watching this issue