You can lag and/or crash a server using very specific builder mechanics
Buggy123 opened this issue ยท 6 comments
Issue description:
Essentially, I have been experimenting with builder chunk loading mechanics for a TC6 rift farm (but that part isn't important).
I'd worked out a lot of the mechanics, when I discovered something strange: the builder loads all of the chunks it's shape card covers when you remove the card from it.
ALL of the chunks.
As in up to a 512x512 area, 33x33 chunks (including borders), totaling 1089 chunks, all loaded at the same time and then unloaded within a few seconds. Every single time you remove a shape card from a builder.
On a private server, I tanked the TPS to less than half within a few seconds by just clicking a max-sized shape card in and out of the builder a few times. You could easily make a server completely unplayable or outright crash it by doing it more quickly for a longer period of time.
Steps to reproduce:
1: Place builder.
2: Obtain a shape card and set it to whatever area is desired.
3: Place shape card in builder.
4: Remove it.
5: All unloaded chunks which the shape card covered will be loaded for at least several seconds, and then unload.
Versions:
- Minecraft: 1.12.2
- Forge: 14.23.5.2836
- McJtyLib: 1.12-3.1.1
- RFTools: 1.12-7.61
It isn't dependent at all on whether or not any blocks are being placed. This will occur in a unpowered, inactive builder with no blocks in a adjacent inventory. It doesn't even require preview mode to be on.
I think it should check for whether preview mode is on when you remove the card. If preview mode is on, then yeah, you'd want to load these chunks to make sure you delete all the preview blocks, but with it off there's no reason to check these chunks at all.
A griefer could still use preview mode to grief, but at least then there'd be a huge area of blocks appearing/disappearing as a indicator.
Preview mode blocks ARE blocks. Turning preview on or off is placing blocks. Namely the support blocks that are used to preview.
But what I mean is, this lag occurs even if preview mode is off. This issue occurs even if you never have preview mode on during any part of this process.
Turning off preview mode immediately loads and deletes all of the preview blocks. This means that if preview mode is off when the card is removed, there is no way that there could be preview blocks still in existence (ignoring the possibility of multiple builders, which nonetheless still shouldn't allow for preview blocks to continue existing when they shouldn't).
So there's no reason (in normal operation) to have the builder check these chunks on card removal if preview mode is off at that instant. Having it check anyway might help with edge cases where preview blocks are there for some reason, but personally I'm not sure that's worth the tradeoff.
It always checks just to try to make it sure that the blocks get removed (if it somehow didn't work the first time). Not going to change that in any case. It is hard enough as it is already