mojira.dev
MC-11571

Huge lighting updates lag the game.

 The bug

This bug causes alot of light updates, dropping your FPS to 0 and most likely crashing your game.

This has been used for around a year now on several servers, this causes players to crash their game.

How to reproduce

  1. Create a new world (superflat, cheats on)

  2. Execute command: /fill ~20 ~200 ~-20 ~-20 ~200 ~20 stone

  3. Teleport yourself up to the platform. (/tp @a ~ ~205 ~)

  4. Place 2 observers facing into each other, make a hole 1 block away from the observer. (See screenshot for setup. the observers is to make a repeating redstone clock)

  5. Just place the piston so it pulls the block over the hole.

  6. Prepare yourself to see your FPS drop to 0.

Code analysis

The following is based on a decompiled version of Minecraft 1.12 using MCP940.

In the method net.minecraft.world.chunk.setBlockState() you have this~~

if (j >= i1)
{
this.relightBlock(i, j + 1, k);
}

which relight blocks, but this is causing the massive FPS drops. What this does is, if j (posY) is bigger then i1, it will relight the block on the X, Y + 1, Z the player is.

If you remove the '+ 1' this issue will be fixed. idk why though.

if (j >= i1) 
{ 
this.relightBlock(i, j, k); 
}

----------------------------------------------------------------------

When making a Creative world with bedrock at the bottom, air for most, and bedrock at the top, when you break the bedrock the game lags for about 7 seconds.

Example superflat preset: 3;minecraft:bedrock,250*minecraft:air,minecraft:bedrock;1;

I made a program that will take the "Something's taking too long!" messages and put it in a list. In the attached list, you can see that root.tick.level.connection is taking a VERY long time.

I hope this gets fixed soon, because it can be a huge exploit on servers.

^ original report

 

Linked issues

MC-70253 Big lag spike when placing blocks in very specific circumstances. Resolved MC-72310 Huge momentary block lag when placing a block Resolved MC-74637 Lag spike created when brakeing/placing blocks or light sources. Resolved MC-87947 Placing blocks high in the air causes client lag Resolved MC-92035 When breaking or replacing a hole on the last layer, game stuck Resolved

Attachments

Comments 27

Also, root.tick.keyboard lags when you break the block.

Please force a crash by pressing F3 + C for 10 seconds while ingame and attach the crash report here.

In vanilla, I made a piston that would extend and rectract on an uncovered block. The lag was horrendous. I got down to 0 fps before the F3+C worked. I can upload the world if you want me to.

Yes, please upload the world.
The crash report isn't helpful.

I don't think I broke the redstone, so it may still be running.

17 more comments

This also occurs on Java 8 and on Linux.

confirmed for breaking last bedrock level on 18w30b

change "fill ~20 ~200 ~-20 ~-20 ~200 ~20" to "/fill ~20 240 ~-20 ~-20 240 ~20"

and "/tp @a ~ ~205 ~" to "/tp @p ~ 250 ~"

@unknown It literally doesn't matter. you still drop frames on Y: 200

If the stone platform is at y=200
and is 57 or more blocks across (square)
and all blocks under the platform is air

X=29 (Distance of Light spread from center) Y=200 (Height of platform)
Breaking the block in the middle will produce .5(X^2+1)Y+1 = 84200 (84k) skylight updates

X=15 (Sky Light level) Y=200 (Height of platform)
Replacing the block will produce Y((X^2+2)X^2/3)+X = 3405015 (3405k,  3.4million) skylight updates

 

Oh and redstone dust does NOT produce light updates (they cause block updates)
Repeaters used to in 1.5.2 but that got removed due to lag

Dwayne Slater

Oval

Fry

Confirmed

fps, freeze, lag, light, lighting, lockup

Minecraft 1.4.7, Snapshot 13w10b, Minecraft 1.5, Minecraft 1.8, Minecraft 1.8.1-pre2, ..., Minecraft 18w30b, Minecraft 1.13.1, Minecraft 1.13.2-pre1, Minecraft 1.13.2-pre2, Minecraft 1.13.2

Minecraft 18w43a

Retrieved