Warehouse Sort causes Null Pointer Exception and Infinite Loop
Pyrocantaes opened this issue · 28 comments
Prerequisites
- [x ] I am running the latest alpha version of MineColonies and Structurize for my Minecraft version.
- I checked the MineColonies/Structurize wiki and made sure my issue is not covered there.
- I made sure that this issue is not a duplicate of any existing issue.
Context
- Minecraft Version:15.2
- MineColonies Version: minecolonies-0.13.379-ALPHA-universalminecolonies-0.13.379-ALPHA-universal
- Structurize Version: structurize-0.13.94-ALPHA-universal
- Related Mods and their Versions: See Latest.log
Expected behavior
Warehouse sort doesn't render the game inoperableActual behavior
You can continue to play and but cannot interact with any inventory (Bag/chest/rack).
Can't save the world.. requires Task Kill to end the process
Disk use ramps to 100% between 8.9 and 17MBS per second access
Processor use variable but anything from +5 to +40% usage cyclical over several seconds
Sort the warehouse .. not this happens 8 times out of 10 .. occasionally it works.. Note that the closer to "full" it is the more likely it is to fail.
Sort the warehouse
2.
3.
Logs
- latest.log: <script src="https://gist.github.com/Pyrocantaes/fa002028bd8de26d1f0c1f32f53edbec.js"></script>
Note this is only the first 3500 lines.. the null exception blocks in this log repeat for another 44,000+ lines - crashlog:
Notes
Viewers
- Add a thumbs-up to the bug report if you are also affected. This helps the bug report become more visible to the team and doesn't clutter the comments.
- Add a comment if you have any insights or background information that isn't already part of the conversation.
Downloaded it... I'll test in tomorrow.. may take a couple of days for a definitive answer one way or another..depends on how often I either need to or choose to sort the warehouse..
Okay .. tested it tonight for a couple of hours.. sorted the warehouse about 6 times ... primarily because I had to.. Whilst the whatever underlying change you made obviously works, I have noticed a side effect. As the delivery workers randomly stash their goods and fill up the warehouse, once they get down to about a rack(not 100% sure .. its actually difficult to tell) of space left they stop work.. note this is both retrieving and fulfilling any outgoing requests. As soon as you sort the warehouse, they suddenly all rush out and start working again.. Note I currently have a level 3 warehouse and 6 delivery workers.. I also had another stuck request chain by the looks of things .. a whole double rack of stone swords. I think the double rack of fishing rods is historic from a couple of nights ago..
Okay.. worked out how to do the buildings, but it's slow going.. the barracks is a real pain.. but how do I get the 75 colonists with the same housing assignment, job assignment, and skill levels? Is there a way to copy the relevant data across from one world to the other?
I don't think those things have to be equal, I just need a way to reproduce this bug.
managed to get it to crash tonight, been playing for about 3 hours.. think I successfully sorted the warehouse a couple of times without issue, but having just been through the log, it appears I've been playing for the last hour in a crashed state(or at least in the exception state), so effectively the second sort caused the fatal unrecoverable exception.
Link for the latest log https://gist.github.com/Pyrocantaes/ef7d08f6a2917dfe4847c5cd52328a98.js"
I'd have to zip the whole mod pack including save directories, then ftp it somewhere. If you want to talk less publicly use my discord address.. you should find a couple of posts from last night "Pyrocantaes"
Hmm, I need ways to reproduce this. Could you try to reproduce this in a singleplayer world with minecolonies/structurize only?
It would take me a whole chunk of time to get to this point.. I've got about 2 weeks of play to get here, and I'm having to chunk load 181 chunks to keep the whole town loaded. It's not a small town .. 75 citizens, a dozen or so houses of various levels plus all the other building/guard towers etc.. And the mods are there to make life easy.. trying to even get close in vanilla would be a huge uphill task.
Strangely enough in the 12+ years I've been playing Minecraft, I've done almost nothing in Creative mode.. Can you place specific levels of buildings?
So having placed a load of buildings I'm trying to get the colony to happen, however every control block gives me "the block is missing it's building" and any mine colonies command just gives me "invalid command"
Done that.. have a valid block in the town hall .. it's the only one I can interact with..
The 2 buttons either place the building or place the control block.. so how am I supposed to get the buildings and hence the city if I don't use the one that actually places the building?
In regards to the button .. that's the one I was using..
One additional observation I've made tonight, is that a good indicator that a sort will break the warehouse is when all the couriers stop working..I would guess that's also related to identifying a vacant inventory slot .. I'll try the new build tonight (as it's not 1am)
I've been thinking this issue over (I have 30 years in bespoke software development so I do this sort of thing on an almost daily basis).
There is obviosuly a flaw in the algorithm when dealing with the last available (and not necessarily full) inventory. The problem doesn't appear to occur if during the sort 2 inventories become free, as if I clear "junk" (read over produced request items like swords and fishing rods - another issue that urgently needs addressing.. ignoring warehouse stock before making any production request), so that I have at least 1 inventory free (even if that's enough space across several racks) before sorting the sort doesn't break.
Assuming a double rack in the warehouse is treated as a single inventory, the same as double chests are, the problem may be recreatable fairly easily.
Assuming 8 inventories :-
- Fill with sacks of logs, slabs, planks, and cobble.. leave a couple of stack short
- Fill with assorted building blocks and sapplings
- Fill with wheat seeds and cooked potatoes
- Fill with wheat seeds, beetroot seeds, beetroot, and apples. leave a few stacks short
- Fill with swords and other single armour items
- Fill with fishing rods, and other assorted items, including some apples, wheat seeds, beetroot, beetroot seeds
- fill with a mix of items including a few swords, and fishing rods
- add several items, inclding some seeds, a sword, a fishing rod and a few logs
When adding to (8) ensure there will not be enough space for the sword, fishing rod, and wheat seeds the other inventories.
This may be enough to reproduce. If not then increase to 16 inventories, but ensure the 8 added inventories are filled with other stackable blocks,and that every inventory space is full, even if the stacks themselves are not.
I've been thinking this issue over (I have 30 years in bespoke software development so I do this sort of thing on an almost daily basis).
There is obviosuly a flaw in the algorithm when dealing with the last available (and not necessarily full) inventory. The problem doesn't appear to occur if during the sort 2 inventories become free, as if I clear "junk" (read over produced request items like swords and fishing rods - another issue that urgently needs addressing.. ignoring warehouse stock before making any production request), so that I have at least 1 inventory free (even if that's enough space across several racks) before sorting the sort doesn't break.
Assuming a double rack in the warehouse is treated as a single inventory, the same as double chests are, the problem may be recreatable fairly easily.
Assuming 8 inventories :-
- Fill with sacks of logs, slabs, planks, and cobble.. leave a couple of stack short
- Fill with assorted building blocks and sapplings
- Fill with wheat seeds and cooked potatoes
- Fill with wheat seeds, beetroot seeds, beetroot, and apples. leave a few stacks short
- Fill with swords and other single armour items
- Fill with fishing rods, and other assorted items, including some apples, wheat seeds, beetroot, beetroot seeds
- fill with a mix of items including a few swords, and fishing rods
- add several items, inclding some seeds, a sword, a fishing rod and a few logs
When adding to (8) ensure there will not be enough space for the sword, fishing rod, and wheat seeds the other inventories.
This may be enough to reproduce. If not then increase to 16 inventories, but ensure the 8 added inventories are filled with other stackable blocks,and that every inventory space is full, even if the stacks themselves are not.
Pyrocantaes - could you try version 390 alpha?
It's definitely not a flaw in the algorithm since the algorithm didn't change. This is somewhere around the lines of inventory identification. And 100% sure the same issue as: #6012
So I downloaded 409-Alpha tonight and have been playing for a couple of hours.. Good news.. I haven't had a sort fail. Bad news, the request system is now completely broken. Couriers don't respond to any request what so ever. This means none of the builders are getting any thing they require because none of the manufactures are getting the raw materials they need..
So change of plans, meant I could get testing this tonight. Played for about 2.5 hours. Request system appears to be working, couriers don't appear to be getting stuck. Not had a problem with sorting the warehouse so far. Can we have the same facility for builders or some sort of feature that allows all the non-building blocks to be picked up by the couriers?
Got another few hours in tonight with out any issues, so it looks like the courier/warehouse/request system triangle of issues is now fixed.