BluSunrize / ImmersiveEngineering

Wires, transformers, high voltage! Bzzzzt!
Other
789 stars 393 forks source link

NPE crash in TileEntityMultiblockPart.isDummy #3041

Closed LemADEC closed 6 years ago

LemADEC commented 6 years ago

Description of the issue:

When teleporting to a player's base, client is crashing before rendering blocks in the world.

Crashlog:

https://gist.github.com/LemADEC/2b7cccf1956f4d7838991d093e7f2344

java.lang.ArrayIndexOutOfBoundsException: 0
    at blusunrize.immersiveengineering.common.blocks.TileEntityMultiblockPart.isDummy(TileEntityMultiblockPart.java:265)
    at blusunrize.immersiveengineering.common.blocks.metal.TileEntityFermenter.func_73660_a(TileEntityFermenter.java:77)
    at net.minecraft.world.World.func_72939_s(World.java:1832)

Versions & Modlist

FTB Continuum 1.2.1 including ImmersiveEngineering-0.12-82

BluSunrize commented 6 years ago

Can the player in question move around their base normally?

LemADEC commented 6 years ago

yes, the player also crashes when going there

LemADEC commented 6 years ago
LemADEC commented 6 years ago
LemADEC commented 6 years ago

the block itself is reported as a minecraft:efab_rfcontrol according to MCEdit.

Pictures of the setup after deleting the corrupted block: image image image image

malte0811 commented 6 years ago

I'd say this is a semi-duplicate of #2973. The only way this can happen is if the TE is missing some or all of its NBT-data, and I suspect the same happened there.

BluSunrize commented 6 years ago

closing this due to no further response

LemADEC commented 6 years ago

It's a client crash. What's your question then?

SeraphJACK commented 5 years ago

I met this question too... Server side is sponge, maybe the TE is null then, why not just add a try catch to prevent client crash then we can remove the block?

LemADEC commented 5 years ago

What's your crash report?

SeraphJACK commented 5 years ago

https://paste.ubuntu.com/p/WG4QssX2Dt/

SeraphJACK commented 5 years ago

Seems the issue only affects client side, since after I added the code that allows client remove the corrupted tileentity in client's world, the machine works properly.

And the issue has gone after replacing it, really weird.

LemADEC commented 5 years ago

What code are you referring to?

SeraphJACK commented 5 years ago

TileEntityMultiblockPart::isDummy

SeraphJACK commented 5 years ago

Maybe I got the problem.

My server has sponge installed, and an optimization featured asynchronized light update is enabled by default, which would call Block::getLightValue. In IE's BlockIETileProvider class this method would cause a chunk load, which will cause an async chunk load, and this action will be caught by sponge, maybe then cause the TE corrupt.

Here's some log:

[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*********************************************************************************************************************/
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*                                             Illegal Async Chunk Load                                              */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*********************************************************************************************************************/
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /* Sponge relies on knowing when chunks are being loaded as chunks add entities to                                   */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /* the parented world for management. These operations are generally not threadsafe                                  */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /* and shouldn't be considered a "Sponge bug ". Adding/removing entities from                                        */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /* another thread to the world is never ok.                                                                          */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*                                                                                                                   */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*  Chunk Pos : 45, -12                                                                                              */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*                                                                                                                   */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /* java.lang.Exception: Async Chunk Load Detected                                                                    */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.chunk.Chunk.handler$startLoad$zpm000(Chunk.java:6279)                                     */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.chunk.Chunk.func_76631_c(Chunk.java)                                                      */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraftforge.common.chunkio.ChunkIOProvider.syncCallback(ChunkIOProvider.java:109)                      */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:94)                      */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:118)                           */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.gen.ChunkProviderServer.func_186028_c(ChunkProviderServer.java:89)                        */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.gen.ChunkProviderServer.redirect$onProvideChunkHead$zmn000(ChunkProviderServer.java:678)  */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.gen.ChunkProviderServer.func_186025_d(ChunkProviderServer.java:135)                       */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.World.func_72964_e(World.java:310)                                                        */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.World.func_175726_f(World.java:305)                                                       */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.World.func_175625_s(World.java:6505)                                                      */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     blusunrize.immersiveengineering.common.blocks.BlockIETileProvider.getLightValue(BlockIETileProvider.java:469) */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.block.state.BlockStateContainer$StateImplementation.getLightValue(BlockStateContainer.java:510) */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     org.spongepowered.common.SpongeImplHooks.getChunkPosLight(SpongeImplHooks.java:1521)                          */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.WorldServer.getRawBlockLightAsync(WorldServer.java:5050)                                  */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.WorldServer.checkLightAsync(WorldServer.java:4874)                                        */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.WorldServer.lambda$updateLightAsync$0(WorldServer.java:4990)                              */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     net.minecraft.world.WorldServer$$Lambda$3126.00000000204E40F0.run(Unknown Source)                             */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)                               */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)                               */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*     java.lang.Thread.run(Thread.java:819)                                                                         */
[18:56:45] [Sponge - Async Light Thread/ERROR] [Sponge]: /*********************************************************************************************************************/
malte0811 commented 5 years ago

That looks like it's the same problem as SpongePowered/SpongeForge#2857, and I agree with the EIO dev(s), this is a Sponge bug, despite the log message.

Kantets commented 5 years ago

Tested on forge server players also crashed with this error Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at blusunrize.immersiveengineering.common.blocks.TileEntityMultiblockPart.isDummy(TileEntityMultiblockPart.java:284) ~[TileEntityMultiblockPart.class:?] at blusunrize.immersiveengineering.common.blocks.metal.TileEntityArcFurnace.update(TileEntityArcFurnace.java:75) ~[TileEntityArcFurnace.class:?] at net.minecraft.world.World.redirect$tileEntityUpdate$zbc000(World.java:4132) ~[amu.class:?] at net.minecraft.world.World.updateEntities(World.java:1835) ~[amu.class:?]

SeraphJACK commented 5 years ago

Yeah that's to sponge's fault, as I've given before.

SeraphJACK commented 5 years ago

For a quick fix you can use setblock command to delete corrupted blocks, and disable Async Light Optimization in sponge's configuration (global.conf).

Kantets commented 5 years ago

Async Light be OFF, but... How use setblock ?

SeraphJACK commented 5 years ago

/setblock <x> <y> <z> <tileName> [dataValue] [oldBlockHandling] [dataTag]