Page 1 of 1

[Rseding91] [2.0.11] Stack inserter deadlocks with containers

Posted: Mon Oct 28, 2024 11:54 am
by kj16609
When having a mixed stack belt it is possible for the stack inserter placing items into a container such as an assembler to deadlock. The inserter is stuck attempting to pickup more items and never returns to functioning.
Broken.mp4
Video of stack inserter deadlocking
(7.83 MiB) Downloaded 245 times
This caused me a few issues when I finally upgraded to using stack inserters as portions of my base would stop functioning due to reaching this locked up state.

This state can also be reached from machines on Gleba when the items inside of them turn into spoilage, Causing the machine to not be able to output anymore if you have a single stack inserter as the only inserter and if the spoilage doesn't exactly line up to the required amount for the stack inserter to function.
It was driving me mad trying to figure out why the inserters were randomly deadlocking and most of my factory grinding to a halt.

Re: [2.0.11] Stack inserter deadlocks with containers

Posted: Mon Oct 28, 2024 12:06 pm
by Rseding91
Thanks for the report however that is working correctly. If you can not feed enough items to the stack inserter it will wait until you eventually do. If you don't want that behavior, don't use stack inserters.

Re: [2.0.11] Stack inserter deadlocks with assemblers

Posted: Mon Oct 28, 2024 12:27 pm
by kj16609
The thing that makes me think this is a bug is that the stack inserter will keep picking up items when going from one belt to another, Even if the belt has mixed stacks. Which is not what matches when going from a belt to an assembler.

I guess to clarify. The issue is that the stack inserter will not continue to pickup more items from the belt and insert into the assembler, Despite the status of the inserter being "Waiting for more items".

Edit: I've also renamed the topic title to be more accurate to the issue

Re: [boskid] [2.0.11] Stack inserter deadlocks with containers

Posted: Mon Oct 28, 2024 1:06 pm
by Rseding91
I see now, I was looking at the wrong inserter in the video.

Re: [boskid] [2.0.11] Stack inserter deadlocks with containers

Posted: Mon Oct 28, 2024 1:09 pm
by kj16609
Thanks for looking at it again. I could of probably made it a bit more obvious what the issue was, Sorry.

Re: [boskid] [2.0.11] Stack inserter deadlocks with containers

Posted: Thu Nov 14, 2024 2:19 pm
by robot256
Another potentially related report of a stack inserter getting stuck when items are available: 121423

Re: [boskid] [2.0.11] Stack inserter deadlocks with containers

Posted: Mon Nov 25, 2024 4:07 am
by malventano
Rseding91 wrote: Mon Oct 28, 2024 1:06 pm I see now, I was looking at the wrong inserter in the video.
Just ran into this. Here is more amplifying info in case it has not been fully reporo'd:
- Appears when assembler is feeding from both sides of a mixed belt with a stack inserter. Stack inserter will be stuck 'waiting for more items' even if there are items within reach on the belt.
- An assembler feeding from only one side of the belt seems to be ok (yellow ammo in below pic is ok).
- If I swap from bulk inserters to stack inserters feeding the grenade assemblers in the below pic, they will eventually deadlock similar to the red ammo assembler.
- I thought this had something to do with differing height stacks, but have seen it happen with a fully saturated (stacked) belt.
- I believe the hang occurs if the assembler asks for a second item in the middle of the stack inserter picking up the first.
20241124-225208-.png
20241124-225208-.png (2.72 MiB) Viewed 2479 times
If more is needed let me know and I can try and create a reliable repro scenario / save.

Re: [boskid] [2.0.11] Stack inserter deadlocks with containers

Posted: Mon Dec 02, 2024 9:40 pm
by irisfofs
I think the inserters are stuck because the assembler is over the automated insertion limit for the item in their hand. In your screenshot, the stack inserter is holding steel, but the assembler has 15 steel, which is over the automated insertion limit for that configuration.

What confuses me is why the inserter picked up steel in the first place. Normally, inserters don't pick up items that the machine doesn't need, and it just filled the assembler to over capacity. It also stops picking up more steel (it doesn't end up with 16 in hand), so it's clearly aware the machine is over capacity, but seemingly only after it picked up the steel.

Jammed state:
12-02-2024, 13-12-13.png
12-02-2024, 13-12-13.png (224.23 KiB) Viewed 2299 times
In my testing, it seems to happen much more often (maybe only?) when the stack size on a belt varies. Even one-time switches (like going from 1 to 4 from switching to stack inserters upstream) trigger it. I suspect occasional stack size changes (from upstream non-stack inserters, construction / deconstruction, or similar) are the main cause of deadlocks in real factories.

I made a blueprint that reproduces the issue (tested with max stack size research). After belts are saturated:
- Switching the splitter input priority from left to right (increasing stack size) will jam the inserter. After removing the items stuck in hand, it works normally.
- Swapping from right to left (decreasing stack size) doesn't seem to jam it.
- Removing input priority (mixing stack sizes) will jam the inserter repeatedly.

12-02-2024, 13-29-14.png
12-02-2024, 13-29-14.png (617.35 KiB) Viewed 2299 times

Re: [Rseding91] [2.0.11] Stack inserter deadlocks with containers

Posted: Tue Dec 03, 2024 9:16 pm
by Rseding91
Thanks for the blueprint to reproduce it. I was able to figure out the issue and it's now fixed for the next release.

Re: [Rseding91] [2.0.11] Stack inserter deadlocks with containers

Posted: Wed Dec 04, 2024 5:50 pm
by malventano
I believe this was fully resolved in .22/.23.

Re: [Rseding91] [2.0.11] Stack inserter deadlocks with containers

Posted: Wed Dec 04, 2024 5:51 pm
by Rseding91
malventano wrote: Wed Dec 04, 2024 5:50 pm I believe this was fully resolved in .22/.23.
It is in “resolved for next release” which has not gone out yet.

Re: [Rseding91] [2.0.11] Stack inserter deadlocks with containers

Posted: Thu Dec 05, 2024 6:51 pm
by malventano
Rseding91 wrote: Wed Dec 04, 2024 5:51 pm
malventano wrote: Wed Dec 04, 2024 5:50 pm I believe this was fully resolved in .22/.23.
It is in “resolved for next release” which has not gone out yet.
Understood. Seems odd though as I had a setup that appeared to be triggering this bug, and on .23 I've switched that setup back over to stack inserters and have not yet repro'd after several days.