Create

Create

86M Downloads

Continuously growing visualizedOutputItems / visualizedOutputFluids of Basin

Tidy-Bear opened this issue ยท 2 comments

commented

Description

List<IntAttached<ItemStack>> visualizedOutputItems;
List<IntAttached<FluidStack>> visualizedOutputFluids;

Those 2 lists will be continuously growing but not be cleared in the server side if the Basin is working at a force-loaded chunk without any player, causing:
a. player who loads the chunk will be kicked from the game because of large NBT.
_E%00B ZMN{}DIMAW5NZT

b. server OOM.

Game Log

Client NBT too big:
https://mclo.gs/G1uMPc2

Debug Information

Here is a server console (the command is from my custom debug mod):
image

commented

What are you using to force load the chunks? BasinBlockEntity#write clears that list everytime it's written, so if that method isn't getting called but the BE is still being ticked then something has gone wrong somewhere

commented

The /forceload command or chunk loaders from other mods (Create: Ender Transmission in my playing modpack) can either cause the bug. I believe what's used for force loading is not the key point.

In fact, BasinBlockEntity#write is called periodically while the basin is working. However, the lists are cleared when its parameter clientPacket is true, which only happens when the server sends an update packet (ChunkHolder#broadcastChanges) to nearby (tracked) players.

Therefore, when a player leaves the chunk for a long time (10 min for example) and then returns, the list, which has accumulated a large amount of data, is sent to the client, exceeding the 2 MB NBT limit in vanilla and causing a disconnection from the server.

Here's a stack trace when clearing the lists:

at com.simibubi.create.content.processing.basin.BasinBlockEntity.write(BasinBlockEntity.java:199)
at com.simibubi.create.foundation.blockEntity.SmartBlockEntity.writeClient(SmartBlockEntity.java:169)
at com.simibubi.create.foundation.blockEntity.SyncedBlockEntity.getUpdateTag(SyncedBlockEntity.java:31)
at net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket$$Lambda$17703/0x0000000802ab3a00.apply(Unknown Source:-1)
at net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket.create(ClientboundBlockEntityDataPacket.java:21)
at net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket.create(ClientboundBlockEntityDataPacket.java:25)
at com.simibubi.create.foundation.blockEntity.SyncedBlockEntity.getUpdatePacket(SyncedBlockEntity.java:36)
at com.simibubi.create.foundation.blockEntity.SyncedBlockEntity.getUpdatePacket(SyncedBlockEntity.java:21)
at net.minecraft.server.level.ChunkHolder.broadcastBlockEntity(ChunkHolder.java:255)
at net.minecraft.server.level.ChunkHolder.broadcastBlockEntityIfNeeded(ChunkHolder.java:247)
at net.minecraft.server.level.ChunkHolder.lambda$broadcastChanges$0(ChunkHolder.java:233)
at net.minecraft.server.level.ChunkHolder$$Lambda$18701/0x0000000802bccd90.accept(Unknown Source:-1)
at net.minecraft.network.protocol.game.ClientboundSectionBlocksUpdatePacket.runUpdates(ClientboundSectionBlocksUpdatePacket.java:74)
at net.minecraft.server.level.ChunkHolder.broadcastChanges(ChunkHolder.java:232)
at net.minecraft.server.level.ServerChunkCache.lambda$tickChunks$5(ServerChunkCache.java:377)
at net.minecraft.server.level.ServerChunkCache$$Lambda$16956/0x00000008029ad0d8.accept(Unknown Source:-1)
at java.util.ArrayList.forEach(ArrayList.java:1511)
at net.minecraft.server.level.ServerChunkCache.tickChunks(ServerChunkCache.java:376)
at net.minecraft.server.level.ServerChunkCache.tick(ServerChunkCache.java:315)
at net.minecraft.server.level.ServerLevel.tick(ServerLevel.java:308)
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:936)
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:857)
at net.minecraft.client.server.IntegratedServer.tickServer(IntegratedServer.java:95)
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:679)
at net.minecraft.server.MinecraftServer.lambda$spin$2(MinecraftServer.java:251)
at net.minecraft.server.MinecraftServer$$Lambda$16311/0x0000000802896e00.run(Unknown Source:-1)
at java.lang.Thread.run(Thread.java:833)