Integrated Dynamics

Integrated Dynamics

63M Downloads

Random server tick crash

twothe opened this issue ยท 4 comments

commented

Issue type:

  • ๐Ÿ› Bug

Short description:

Server randomly crashed:

Description: Exception in server tick loop

java.lang.NullPointerException
    at org.cyclops.integrateddynamics.core.network.IngredientObserver.observe(IngredientObserver.java:150)
    at org.cyclops.integrateddynamics.core.network.PositionedAddonsNetworkIngredients.update(PositionedAddonsNetworkIngredients.java:208)
    at org.cyclops.integrateddynamics.core.network.Network.onUpdate(Network.java:439)
    at org.cyclops.integrateddynamics.core.network.Network.update(Network.java:389)
    at org.cyclops.integrateddynamics.core.TickHandler.onTick(TickHandler.java:65)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_1213_TickHandler_onTick_TickEvent.invoke(.dynamic)
    at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90)
    at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:182)
    at net.minecraftforge.fml.common.FMLCommonHandler.onPostServerTick(FMLCommonHandler.java:266)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:712)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
    at java.lang.Thread.run(Thread.java:748)

Versions:

  • This mod: 1.0.18
  • Minecraft: 1.12.2
  • Forge: forge-14.23.5.2838

Log file:

https://pastebin.com/dKLUaDzL

commented

Thanks for reporting, I'll look into it as soon as possible!

commented

After the crash the Energy Interface on an Energy Battery caused the network to stop transmitting energy (it was working fine for days before). After removing that (unnecessary) interface energy it once again transmitted through the network. Not sure if there are any relations to this issue.

commented

According to the code this is a classical threading issue.

lastObserverBarrier is set to null within a thread but checked outside the thread without appropriate locks. The code in general seems a bit fishy.

I recommend to use submit instead of execute at that point and then simply call get on the returned future in the next tick to force-wait for completion without having to fiddle with latches and locks altogether.

commented

Thanks for the suggestion @twothe, futures are indeed a better solution.