Tinkers' Complement

Tinkers' Complement

27M Downloads

Server crash related to alloying using Porcellain Heater/Tank/Alloyer while creating liquid Obsidian.

werwolfberlin opened this issue · 20 comments

commented

Time: 4/24/19 7:37 PM
Description: Ticking block entity

java.lang.NullPointerException: Ticking block entity
at net.minecraftforge.fluids.FluidTank.fillInternal(FluidTank.java:188)
at slimeknights.tconstruct.library.fluid.FluidTankBase.fillInternal(FluidTankBase.java:22)
at net.minecraftforge.fluids.FluidTank.fill(FluidTank.java:149)
at knightminer.tcomplement.melter.tileentity.TileAlloyTank.tryRecipe(TileAlloyTank.java:168)
at knightminer.tcomplement.melter.tileentity.TileAlloyTank.func_73660_a(TileAlloyTank.java:97)
at net.minecraft.world.World.func_72939_s(World.java:1835)
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:613)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668)
at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:185)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
at java.lang.Thread.run(Thread.java:745)

crash-2019-05-17_17.02.15-server.txt

commented

Its running on SkyFactory 4 (v4.0.5)

If it does not crash on startup to to the platform close to 1057, 66, -1015 and put some netherrack from the chest into the Mechanical Squeezers and wait a bit.

Backup--world--2019-05-17--17-04.zip

commented
commented
commented

Can you give a screenshot of your setup? And can you reproduce this crash in a pack with just Tinkers Construct and Tinkers Complement?

Without looking at the code, this looks like that race condition that often happens when filling and emptying at the same time, something that is normally avoided in normal forge

commented

Ah yes, looking into the code, this is a crash I have seen, but never in the alloy tank. Somehow between the time the tank starts filling and the time it finishes filling, the fluid it added disappears. This would be impossible without threading, which except in case where a mod is lisening to the FluidFillingEvent and also modifying the fluid. In any case, its entirely Forge code where the crash is happening so a fix is difficult without just rewriting the whole class

I have never seen this crash in an instance with just Tinkers Complement and its really difficult to test anything in a modpack. If you can provide steps to reproduce outside of a modpack with 100s of mods that would greatly help, otherwise I still have no idea where to start trying to fix this as its never happened for me in any pack.

commented
commented

The issue is not with the method being called multiple times, making tryRecipe synchronized would not fix it. The issue is with interacting with the fluid tank while someone else also interacts with the fluid tank. Basically, none of the alloy tank code is directly involved. The copy is not the issue either, that works fine as the crash is not on that line. As I said above, the crash is in the fluid tank code. Issue is not even making that synchronized would fix it, because this is calling fill, but it seems something calls drain in the mean time.

There is nothing special about setting up a workspace, you just need to use Gradle to pull in dependencies. I suggest looking up a couple tutorials on setting up mod workspaces.

commented

As a little more detail, the crash happens on this line, whic is the case of the tank being filled when previously empty. Thing is, the object that NPEs is created just a few lines above. That leaves only two ways it might have changed: another thread modified the block, which shouldn't happen as only one thread is supposed to deal with ticking tile entites, someone listening to the FluidFillEvent drained the tank, which brings us back to mod conflict, or something in onTankContenteChanged, which last I checked is just a client sync. I will say if anything is worth looking into, it's the last one as the rest seem highly unlikely.

commented

Alright, digging into onTankContentsChanged, the only case I see that might cause an issue is with the comparator updating code. Specifically, the tanks cause a block update when the contents change its comparator output, which might trigger the faucet update method to start pouring before the tank finishes filling. I created this beta release of Ceramics to test a potential fix for that with the porcelain faucets, does it fix the issue? (note this will not affect the seared faucets, those will need to be separately updated in Tinkers Construct)

commented
commented
commented

I'd like to chime in to report that I just came across this exact issue, and using the beta build fixed it.

Details on how mine was set up: Two seared tanks with an Alloy Tank in the middle, a faucet with a Cyclic Redstone Clock on the other side, set to 1-tick pulse every 2 seconds. The seared tanks are always set to fill via Xnet, and the clock will not affect the alloy melter afaik.
https://imgur.com/dzm73jw

commented

Alright, this will be fixed in a future release of Tinkers Construct and Ceramics

commented

Should be fixed in the latest Tinkers.

commented

We just got this crash twice in Sevtech 3.2.0, which uses
Tinkers' Construct 2.12.0.135
Tinkers' Complement 0.4.3
Ceramics 1.3.7

Crash report:

Description: Ticking block entity

java.lang.NullPointerException: Ticking block entity
at net.minecraftforge.fluids.FluidTank.fillInternal(FluidTank.java:188)
at slimeknights.tconstruct.library.fluid.FluidTankBase.fillInternal(FluidTankBase.java:22)
at net.minecraftforge.fluids.FluidTank.fill(FluidTank.java:149)
at knightminer.tcomplement.melter.tileentity.TileAlloyTank.tryRecipe(TileAlloyTank.java:173)
at knightminer.tcomplement.melter.tileentity.TileAlloyTank.func_73660_a(TileAlloyTank.java:102)
at net.minecraft.world.World.func_72939_s(World.java:1838)
at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:613)
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:767)
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:397)
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:668)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
at java.lang.Thread.run(Thread.java:748)

First time this happened I found this thread, and because we were using a seared brick faucet we replaced it with a porcelain faucet hoping it would fix the problem. But within 5 minutes it happened again. Our setup was a simple 2 seared melters feeding into an alloy tank, with a faucet being triggered by a rotating lever (as one does in Sevtech age 2).

I considered using alternate means of extracting the fluid and casting from a tank instead, but given the crash is most likey caused by fluids being removed at the same time as being added (it does not crash if there's nothing being extracted), I doubt that would fix anything (plus restarting the server then running to demolish the setup before it crashes again is quite the chore).

We unfortunately had to resort to the work around: ditch the alloy tank and setup a full smeltery.

commented

Porcelain faucet is from Ceramics, looks like the alpha with the fix test never got fully released. Use the seared faucet and the problem should go away. I'll upload a new 1.12 Ceramics build later tonight with the fix.

commented

Porcelain faucet is from Ceramics, looks like the alpha with the fix test never got fully released. Use the seared faucet and the problem should go away. I'll upload a new 1.12 Ceramics build later tonight with the fix.

Unfortunately, as I said we started out using seared faucets. That's where the crash originally occurred.

commented

Here's the crash report that I quoted the stacktrace out of, this was with using the porcelain faucet

crash-2021-01-04_23.29.59-server.txt

And here's the one using the seared faucet.

crash-2021-01-04_21.37.24-server.txt

Getting one with the latest Ceramics will be harder as it's a modpack (sevtech) running on a server. I'll see what I can do.

commented

Porcelain faucet is as expected without updating. Seared faucet is an entirely different crash, so should be a separate issue. Hard to tell what to do about it, as the crash is just a bunch of vanilla code instead of my code.

commented

If that's the case, get me a full crash report using the latest Ceramics version. You cut off half the report above.