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

 

Related issues

MC-70253 Big lag spike when placing blocks in very specific circumstances. MC-72310 Huge momentary block lag when placing a block MC-74637 Lag spike created when brakeing/placing blocks or light sources. MC-87947 Placing blocks high in the air causes client lag MC-92035 When breaking or replacing a hole on the last layer, game stuck MC-92686 Extreme sudden fps drop and lag when covering the void from view MC-95513 Using /fill command for large range causes game stuck or a crash MC-101850 Massive lag with light updates MC-102346 Minecraft freezes for a second when building in the air MC-104458 Lag when breaking block over the void MC-104812 /fill on top of world MC-105156 Shadows cause lag in the overworld! MC-105353 Lag, when you are placing a Block, which blocks the view in the void MC-118032 Light freezes mc MC-125149 Slabs at y 256 causing major lag MC-126740 Huge block lag MC-132376 Game Freezes When Block is Placed MC-136549 Skylight / light updates FPS lag

Attachments

Comments

migrated
[media][media][media][media][media][media][media][media]
Dwayne Slater

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

kumasasa

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

Dwayne Slater

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.

kumasasa

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

Dwayne Slater

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

kumasasa

Confirmed.
Getting

2013-03-11 22:57:56 [SERVER] [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
2013-03-11 22:58:12 [SERVER] [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
2013-03-11 22:59:20 [SERVER] [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
2013-03-11 23:00:06 [SERVER] [WARNING] Can't keep up! Did the system time change, or is the server overloaded?
2013-03-11 23:00:11 [SERVER] [INFO] Saving and pausing game...

in the console.

fienxjox

Cannot reproduce in 14w11b. World preset used:

2;1x7,10x0,1x3;2;

The used:

/fill ~ ~ ~ ~-40 ~-1 ~40 minecraft:air

to cause as many lighting updates as possible. Smooth lighting at maximum, render distance 16.

StrangeOne101

I can reproduce this in the latest 14w11b snapshot. Causes lag that lasts just under half a second.

Way to reproduce:

1. Create a new world and dig down with a 1x1 tunnel to bedrock level.
2. Use the fill command to dig out a 40x10x40 area around you.
3. Remove all light in the area.
4. While standing in the empty area, place 1 block in the tunnel you dug to block the light from the sky. Can also be seen when the block is removed.

ggxl

I've heard that this can be problematic for complicated, exposed redstone mechanisms (because lighting updates need to occur whenever dust and such turns on/off).

Sonicwave

Are the affected versions still getting updated? (MC-72310 is for 1.8.)

Sonicwave

Confirmed for 1.8.1-pre2.

KingSupernova

I noticed that this only happens with opaque blocks, implying that it is a lighting issue. Also, if the hole you are filling in is filled with water, it won't lag. By the way, a much easier way to test this is to just make a one layer thick superflat world.

Bentroen

Confirmed for 1.8.1. As a prove that this is related to lighting, if you cover yourself in a 1x2x1 hole with no light (or any room with a low light level), open a hole to the void, and then cover it, it will not lag, because of the low light level. But if you don't block the light, it will lag a lot.

Sonicwave

Confirmed in 1.8.2-pre4. The lag seems much more extreme when blocking the light than when removing the block.

user-f2760

confirmed for 15w44b

PlNG

"Simple" build that confirms the issue.
Punch obsidian to observe normal behavior.
Toggle lever (This slides a block under the chest to expose darkness)
Punch obsidian to observe the lag.

These spike to 50% for me:
root.gamerenderer.level.terrain_setup.culling.build_near 1.8.9
root.tick.level.entities.blockEntities.aqr.checkedPosition 15w51b

Alun Blue

The way I came across this bug was when changing a large 1 block tall plane of grass blocks. Since there was no light underneath the platform, it would lag when removing the light from underneath the platform when the hole creating the light (from the sky) was filled in. This only happened when the light went away.

For me it specifically caused a 2 - 3 second lag in root.tick.keyboard

Sven

Well you can add 1.9.2 to the list and I don't really think this is a creative only issue either... I noticed lagspikes when building the roof and the last block just kills it completely (client and server both on quite some hardware)...

https://www.youtube.com/watch?v=UdZ-mKk5i1Q

Midnaait

Still happening in the 1.12 pre-release 6

McModknower

Still in 1.12.2 Pre-release. Please fix this Mojang.
If you put a Piston on the right Position with a clock you can effectively crash every client in the sourrounding.

[media]

Daniil Aripov

From all comments I noticed this is both client-side and server-side issue. When removing light source at underground, it would lag more than if you remove it at surface during daytime. More checks needed about light updates client-side and server-side.

LuxiKeks

This is affecting every 1.13 snapshot as well.

TheDoctorLink

This also occurs on Java 8 and on Linux.

Saisho Bready

confirmed for breaking last bedrock level on 18w30b

RedCMD

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

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

Oval

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

RedCMD

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