Skip to content

[Bug] Crash when taking schematics on a server with pcaSync and Enhanced Block Entities #119

Description

@theterrabite

Minecraft Version

1.20.4

MasaGadget Version

0.18.4-alpha.1

Description

When taking a schematic on a server using the most recent version (1.20.4-0.3.190+9e97daa-beta) of Nyan's Plusls Carpet additions with pcaSyncProtocol enabled server side and with the most recent litematica (0.17.3), masaGadget, and enhanced block entities(EBE v0.10.1 for 1.20.4) client side I am crashing when saving a schematic, it boots me from the server while attemtping to sync block entities.

I have appended some messages from Masa & Sakura Ryoko that explain the error in greater detail, as that is where I got help with this bug.

masa — Today at 5:19 AM
seems like the renderer stuff happens is via MasaGadget updating some block entity and then EnchancedBlockEntities does some renderer stuff
it's also wrong that MasaGadget accesses the world from the network thread apparently
so basically it's a MasaGadget bug

Sakura-Ryoko — Today at 6:16 AM

    at foundationgames.enhancedblockentities.util.WorldUtil.rebuildChunk(WorldUtil.java:24) ~[enhancedblockentities-0.10.1 1.20.4.jar:?]
    at net.minecraft.block.entity.DecoratedPotBlockEntity.handler$emk000$enhancedblockentities$enhanced_bes$updateChunkOnPatternsLoaded(DecoratedPotBlockEntity.java:524) ~[client-intermediary.jar:?]
    at net.minecraft.block.entity.DecoratedPotBlockEntity.readNbt(DecoratedPotBlockEntity.java:67) ~[client-intermediary.jar:?]
    at com.plusls.MasaGadget.util.PcaSyncProtocol.updateBlockEntityHandler(PcaSyncProtocol.java:160) ~[MasaGadget-1.20.4-3.2.334 08c8f70-stable.jar:?]
    at net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking.lambda$wrapUntyped$0(ClientPlayNetworking.java:374) ~[fabric-networking-api-v1-3.1.8 2e5ac5484f-f085a2cd2ccf2cb1.jar:?]

sus
try removing the mod called enhancedblockentities

[02:23:00] [Netty Client IO #8/INFO]: [STDERR]: java.lang.IllegalStateException: Accessing OpenGL functions from outside the main render thread is not supported when using Sodium
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at me.jellysquid.mods.sodium.client.render.util.RenderAsserts.validateCurrentThread(RenderAsserts.java:15)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at me.jellysquid.mods.sodium.client.render.chunk.RenderSectionManager.scheduleRebuild(RenderSectionManager.java:438)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.scheduleRebuildForChunk(SodiumWorldRenderer.java:461)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.scheduleRebuildForChunks(SodiumWorldRenderer.java:451)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer.scheduleRebuildForBlockArea(SodiumWorldRenderer.java:441)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at net.minecraft.class_761.method_16037(class_761.java:19297)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at net.minecraft.class_761.method_8570(class_761.java:2414)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at foundationgames.enhancedblockentities.util.WorldUtil.rebuildChunk(WorldUtil.java:24)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at net.minecraft.class_8172.handler$emk000$enhancedblockentities$enhanced_bes$updateChunkOnPatternsLoaded(class_8172.java:524)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at net.minecraft.class_8172.method_11014(class_8172.java:67)
[02:23:00] [Netty Client IO #8/INFO]: [STDERR]:     at com.plusls.MasaGadget.util.PcaSyncProtocol.updateBlockEntityHandler(PcaSyncProtocol.java:160)

Which basically means that the 'sync protocol' was taking too long in the wrong thread, so it punted the rendering to not be in the render thread probably via a network thread assert
But to me, this is the main suspect if not masa gadget --> at foundationgames.enhancedblockentities.util.WorldUtil.rebuildChunk(WorldUtil.java:24)

masa — Today at 6:42 AM
It's MasaGadget's fault, it's handling the packet on the network thread and accessing the world from it. It should be scheduled to the main thread for accessing the world. Even so EBE is also kinda sus if it renders something directly from a data change.

To Reproduce

Install the aforementioned serverside mods on a server, then the listed client side mods on your client and attempt to take a schematic with a moderate amount of block entities, sometimes with fewer block entities it doesn't crash.

Expected behavior

I expect masagadget to work with pcaSync protocol and not interfere with EBE.

Log

Client side logs

Server side logs with pcaDebug enabled

Latest CI build tested

  • I confirm that this problem still exists with the latest CI build.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions