GTNewHorizons / GT-New-Horizons-Modpack

New Modpack with Gregtech, Thaumcraft and Witchery
https://www.gtnewhorizons.com/
Other
886 stars 275 forks source link

AAL Batch Mode maybe duping items after server restart? #16562

Closed fluffle closed 1 week ago

fluffle commented 1 week ago

Your GTNH Discord Username

fluffle

Your Pack Version

2.6.1

Your Server

private mp

Java Version

Java 21

Type of Server

Vanilla Forge

Your Expectation

No free circuits.

The Reality

I am not exactly sure of how this happened, so I apologize in advance for the poor quality of the bug report. There are a number of assumptions here, any of which could be incorrect.

I have an 8x dedicated AAL setup for producing each high-tier circuit. These each have an AE subnet with a 16M item / fluid storage cell and a bunch of stocking input buses/hatches for the AALs. These setups have been working Just Fine for a reasonable amount of time on 2.6.1.

While the AALs for making Bio SCs were very busy (of the order of 150-200k queued circuits in the subnet) I ended up having to restore my server from the most recent backup. Before this it got restarted forcibly a few times because of an on-chunk-load NPE from an information panel with a GT card pointing at a lapotronic supercapacitor I just broke. (Fun!)

About a day later I was rather surprised to find the AALs still crafting, and millions of Bio SCs in my AE system. I checked them all, they were running at max parallels (128 Bio SCs per 6.4s slice) producing 1024 Bio SCs every 6.4s and consuming the expected power cost. But! For some reason the recipe was only taking enough input items / fluid for a single parallel per AAL every 6.4 seconds, giving me 128x my outputs per input. It took another day or two to clear the backlog: I now have 52M Bio SCs where I am pretty sure I should only have ~2M -- that's where the level maintainers are supposed to stop crafting.

Kicking off Bio SC crafts now results in the correct item counts being consumed again for full parallels.

I have looked at the code a little bit, and I will attempt to look more later, but I believe @NotAPenguin0 was the person who added batch mode to the AALs. I am not sure how reproducible this is either, given that I am simply assuming that the restarts / restore-from-backup is what triggered this.

Your Proposal

I'm not sure what particular edge case this managed to fall through, but it's probably something that needs to be fixed. I'm hoping someone familiar-ish with the code will see the description of the problem and go "aha!".

I suppose I also need to go void 50M free Bio SCs... :-/

Final Checklist

NotAPenguin0 commented 1 week ago

Fixed already in https://github.com/GTNewHorizons/GT5-Unofficial/pull/2627