Creators-of-Create / Create

[Forge Mod] Building Tools and Aesthetic Technology
MIT License
2.69k stars 867 forks source link

Crash when using mechanical press in 1.20, create 0.5.1.f #6053

Open Wyrmlet opened 5 months ago

Wyrmlet commented 5 months ago

When making things on a mechanical press in a modpack, I have encountered numerous server crashes when the item was created. After some troubleshooting in https://github.com/TerraFirmaGreg-Team/Modpack-1.20.x/issues/202, it appears that the problem is related to this mod. Server crash log: crash-2024-01-19_18.45.01-server.txt

After looking into it, it seems to me that the issue is caused by this line: https://github.com/Creators-of-Create/Create/blob/2201d87da7744cf9ee3f83e1e4c21643244f342b/src/main/java/com/simibubi/create/content/logistics/depot/DepotBehaviour.java#L147 As it does not check if a player holds an item or not and tries to write something to it, causing a null pointer exception. I suggest adding a check for that, which should be rather straightforward.

Wyrmlet commented 5 months ago

Gah, the github feature to mention a line of code in a new issue bypassed the issue templates. Hopefully that's not a problem.

VoidLeech commented 5 months ago

The null check happens at https://github.com/Creators-of-Create/Create/blob/a41053b8966edf7bd9732223b18f783fdb52521d/src/main/java/com/simibubi/create/content/logistics/depot/DepotBehaviour.java#L118-L119

Between there and the point of your NPE, none of the code sets heldItem to null without returning out of the function. Fairly confident this is not an issue with Create. You could try a binary search to find the conflicting mod. I noticed open parties and claims in the mixins. Chunk claiming mods can be quite aggressive in what they allow to happen to a chunk, which could be undoing an assumption that Create's code is based on. Is this happening in a claimed chunk per chance and if so can you reproduce in an unclaimed chunk and/or without a chunk claiming mod installed?

Wyrmlet commented 5 months ago

Huh, it did happen in a claimed chunk. Could be worth it to test that, though that could be problematic since the crash doesn't seem to have a clear trigger, instead only happening... Sometimes. Still, thanks for the help.

IThundxr commented 5 months ago

Yeah most likely a issue with another mod/a mod mixining into create and failing to do a null check

xiaoACE6716 commented 4 months ago

I ran into the same problem on my own server. The error is the same as that posted by Wyrmlet. After research, in my opinion, since the code has been executed to Line 147, then the heldItem is not null when the null check part mentioned by VoidLeech is executed. (Translate from Google)