mojira.dev
MC-273115

Occasional lag spikes in versions 24w14a and above

From snapshot 24w14a to the latest prerelease, I occasionally get a lag spike about every 30 seconds or so. This doesn't happen in 24w13a or earlier. I suspect that it may be caused by java's garbage collection, as when the lag spike happens, the memory usage goes down in the top-right of the debug screen. It doesn't always happen when the memory usage goes down, it only happens around half the time.

The only significant thing that is different between 24w13a and 24w14a is the change from Java 17 to 21, so something about java 21 could be causing the issue.

Linked issues

Attachments

Comments

[MOD] Greymagic27

Does MC-273262 describe your issue?

ItsDaCreeper

Yes, it does seem to match the description of MC-273262, except for the part where exiting the game gives an error code of -1073740940 (I just get exit code 0). Sometime after I submitted this bug report, I tested 24w13a with with java 21 instead of 17, and the lag spikes appeared, so it seems to be an issue with the default garbage collector used in java 21 (G1GC). I tried switching to a different garbage collector, and the problem went away. I did load up 1.21 to test this bug again (using default launcher settings), and it seems that it more of fps drop than a 1 sec freeze. However, testing in a default world instead of a superflat world, the problem still persists. When I tried a different garbage collector (ParallelGC) instead of the default G1GC, the problem went away.

Chandler

It would be fantastic if you could post this information on MC-273262 as well

ItsDaCreeper

(Unassigned)

Unconfirmed

Performance

1.20.6, 1.21 Pre-Release 4

Retrieved