[1.1.59] synchronised inserters fall out of sync while depositing items on belts

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Fooluaintblack
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Oct 15, 2020 8:14 am
Contact:

[1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Fooluaintblack »



The blueprint contains a test setup for a train-based sulfur and sulfuric acid build. Critically, each pair of sulfur/sulfuric acid chemical plants is a distinct system from the other three pairs. Each pair has dedicated water, petroleum, and iron plate inputs that are isolated by dedicated train replenishment wagons, belts, and pipes. The inserters are expected to remain synchronised with eachother, but this is inconsistent. Around the 20th craft, at least one sulfur unloading inserter will deposit its hand contents on the belt one tick slower than the others. The attached save file begins at craft 21, craft 24 is where the problem is first observable.

The build has different length pipes, and the left two pairs of chemical plants are plumbed slightly differently than the right two pairs. Still, the loss of synchronisation is observed within the left two pairs of chemical plants which are essentially identical. When the failure occurs, the fluid volumes appear to be synchronised, the crafts finish at the same time, and inserters collect sulfur from the chemical plants on the same tick. The inconsistency appears while the inserters are depositing items on the belts, or seeming to swing back to chemical lab at different speeds. During one observation, the inserters slowly resynchronised, which was unexpected.

Image
Attachments
factorio-current.log
Log file generated when save was made
(14.16 KiB) Downloaded 57 times
Inserters Desync.zip
(5.99 MiB) Downloaded 63 times

Loewchen
Global Moderator
Global Moderator
Posts: 8306
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Loewchen »

All behavior is dictated by the update order, so if it does not create an actual desync it is not a bug.

SoShootMe
Filter Inserter
Filter Inserter
Posts: 475
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by SoShootMe »

Loewchen wrote:
Tue May 24, 2022 1:16 pm
All behavior is dictated by the update order, so if it does not create an actual desync it is not a bug.
Do you mean the order between items on the belt moving and items being added to the belt by the inserter?

I couldn't replicate the described behaviour using the blueprint, but I see it loading the save without mods, where I can also see differences in the position of the sulphur on the belts.

Fooluaintblack
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Oct 15, 2020 8:14 am
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Fooluaintblack »

Loewchen wrote:
Tue May 24, 2022 1:16 pm
All behavior is dictated by the update order, so if it does not create an actual desync it is not a bug.
Just to clarify, I am not reporting a multiplayer desync issue. I knew "sync" is correlated with multiplayer issues, and I should have stated this in the top post.

To me, inconsistent swing times or position of items on a belt is at least undesirable. Whether or not we classify this as a bug is beyond me. Regardless, I would like to be able to explain the cause so I can adapt my designs around it. I'm outside of my depth here, but could this behaviour be explained by multithreaded belts?

Fooluaintblack
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Oct 15, 2020 8:14 am
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Fooluaintblack »

Moving the undergrounds up so the inserters deposit sulfur onto a belt seems to affect the behaviour. My testing so far is not rigorous, but the inserter behaviour is consistent with my expectations. However, what relevant variables an underground belt introduces is less clear to me.

Loewchen
Global Moderator
Global Moderator
Posts: 8306
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Loewchen »

Fooluaintblack wrote:
Tue May 24, 2022 10:33 pm
Just to clarify, I am not reporting a multiplayer desync issue. I knew "sync" is correlated with multiplayer issues, and I should have stated this in the top post.

To me, inconsistent swing times or position of items on a belt is at least undesirable. Whether or not we classify this as a bug is beyond me. Regardless, I would like to be able to explain the cause so I can adapt my designs around it. I'm outside of my depth here, but could this behaviour be explained by multithreaded belts?
Yes, I understand that you are not reporting an actual desync. My point is, that the game is 100% consistent, but only for the exact same origin. If you create a blueprint of a setup and place it on different coordinates, that setup can have its entities in different update order and that can create differences in behavior that may or may not be noticeable right away.

Fooluaintblack
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Oct 15, 2020 8:14 am
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Fooluaintblack »

Loewchen wrote:
Tue May 24, 2022 10:56 pm
My point is, that the game is 100% consistent, but only for the exact same origin. If you create a blueprint of a setup and place it on different coordinates, that setup can have its entities in different update order and that can create differences in behavior that may or may not be noticeable right away.
I've also noticed that deleting the entities and then undoing the delete can affect the behaviour. The top post describes an observable inconsistency at the 24th craft, but deleting and replacing the entities changes which craft the issue is observable. I did this just now, and I could see the inserter's hand contents fall out of sync around the 21st craft. Would origin in time affect the update order when all assemblers, inserters, belts, beacons, pumps, tanks etc. are replaced on the same tick?

Loewchen
Global Moderator
Global Moderator
Posts: 8306
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Loewchen »

Fooluaintblack wrote:
Tue May 24, 2022 11:39 pm
Would origin in time affect the update order when all assemblers, inserters, belts, beacons, pumps, tanks etc. are replaced on the same tick?
If the placement of all the entities of the blueprint happens at the same tick and at the same coordinates, then I would expect the update order and actual behavior to be not dependent on the actual tick value.

Rattlembones
Burner Inserter
Burner Inserter
Posts: 10
Joined: Mon Sep 11, 2017 7:43 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Rattlembones »

Loewchen wrote:
Wed May 25, 2022 12:01 am
If the placement of all the entities of the blueprint happens at the same tick and at the same coordinates, then I would expect the update order and actual behavior to be not dependent on the actual tick value.
I've reduced the blueprint to a smaller test unit which demonstrates the behaviour. This video is a single capture with the game running at normal speed where I paste, observe, and undo the same blueprint at the same coordinates over and over. The inserters appear synced with each other until the paste at 1:00, where the inserters almost immediately fall out of sync with each other.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2530
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by FuryoftheStars »

Tbh, I’m not exactly sure why it matters, but you can use a circuit wire to keep them all in the same pattern and (mostly) in sync (which ever inserter is your trigger inserter will always be a tick or two ahead of the rest).

That said, have you tried looking into if it’s actually the inserters, or the chem plants, or the supply going to them? (You’d need to place the entities with time paused and then advance one tick at a time, looking everything over to see exactly when and where it falls out of sync.)
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Fooluaintblack
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Oct 15, 2020 8:14 am
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Fooluaintblack »

FuryoftheStars wrote:
Wed May 25, 2022 1:56 pm
Tbh, I’m not exactly sure why it matters
The problem is a cascading chain of events that lead to catastrophic failure. As each pair of chem plants is a distinct system from the others, one falling out of sync could brick the production cell and anything that relies upon it. Imagine the sulfur outserters desync, leaving different amounts of sulfur inside the chem plant on different ticks. While the slow sulfur outserter is swinging back to the chem plant, the sulfuric acid inserter will be able to take more sulfur to make acid than the other pairs. As a result, more acid and less sulfur is produced by this pair. Under certain conditions like unstable water supply, the variance can accumulate until one pair is so far out of sync with the others that a train cannot fully unload blocking the station, stopping production, and starving the next cell in the supply chain, grinding the entire base to a halt.

While the build could (and probably will) be redesigned, the observed behaviour is inconsistent with my expectations and a redesign shouldn't be necessary.
FuryoftheStars wrote:
Wed May 25, 2022 1:56 pm
you can use a circuit wire to keep them all in the same pattern
If circuits were needed, I would probably use a fractional clock to enforce synchronicity.
FuryoftheStars wrote:
Wed May 25, 2022 1:56 pm
That said, have you tried looking into if it’s actually the inserters, or the chem plants, or the supply going to them? (You’d need to place the entities with time paused and then advance one tick at a time, looking everything over to see exactly when and where it falls out of sync.)
This is addressed in previous posts, particularly the first one. Additionally, the save file should start with time paused near where the variance can be observed.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2530
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by FuryoftheStars »

They're distinct systems, but one is capable of robbing the sulfur from another? I guess I'd have to see the whole setup in order to understand. I'm unfortunately unable to load up the game at this time, though.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

mmmPI
Smart Inserter
Smart Inserter
Posts: 2728
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by mmmPI »

FuryoftheStars wrote:
Thu May 26, 2022 3:34 am
I guess I'd have to see the whole setup in order to understand. I'm unfortunately unable to load up the game at this time, though.
https://www.youtube.com/watch?v=_Yge8YSGhnU

The several early copy paste are fine, but at 1 minute, the last of the copy paste behave differently than the others for no apparent reason, a noticeable difference in inserter timing while they should according to all expectations stay synchronized.

they are copy pasted on the same coordinates and inside the same chunk.
Fooluaintblack wrote:
Wed May 25, 2022 9:48 pm
Under certain conditions like unstable water supply, the variance can accumulate until one pair is so far out of sync with the others that a train cannot fully unload blocking the station
[...]
While the build could (and probably will) be redesigned, the observed behaviour is inconsistent with my expectations and a redesign shouldn't be necessary.
[...]
If circuits were needed, I would probably use a fractional clock to enforce synchronicity.
From the video it seem hard to identify which condition is causing the inserters to offset their timings, both chem plant are fed with infinite water pipes.

Otherwise an unstable water supply would necessarily cause the inserter to fall out of sync if one chem plant is not receiving enough water to start a cycle like the others but a little later.

Therefore a fractional clock to enfore synchronicity may move the problem around, because the variance could be the quantity of sulfur inside chem plants. That's what the video suggest, since in the video inserters are active when the chem plant has finished its product, it shows that sometimes one chemplant is faster than the others. If wire-controlling inserters to trigger at periodic interval, you may run the risk that one time one inserter have nothing to pick up, and that skipped sulfur created 1 tick too late to be picked up may pile up eventually.

The observed behavior in the video is inconsistent with my expectations too otherwise i wouldn't have had such reserve about the fractional clock that i think i have seen used for nuclear reactor fuel synchronisation.

When trying to load the save game, it was said to me that 1 mod had no published version, (Freeenergy combinator) then when loaded without it and looking at the thing tick by tick, i noticed the 2 right chem plant producing sulfur are already a little delayed, they show 98% while the 2 on the left show 100% ( values taken at the start)

After 2 cycle of production the delay is 1 tick still, but they are at 99% when the 2 left chem plant are already at 100%, then go up for another cycle and up to 11% where the other 2 pairs are still at 100%. (values taken when at product crafted = 23 )

Later on when product crafted = 365, there is still this 1 tick delay between right and left pair, but i noticed that 2nd module starting from the right side had less sulfuric acid and less overal production 28 vs 31 for the 3 others, the difference can be found in the chest in form of raw sulfur.

This cause a variance in water tank that will eventually cause problem.

I noticed that even the 2 chem plant producing sulfur on the left side end up out of sync when the 2 chem plant have produced 396 sulfur, the upper ones that produce sulfuric acid have a different quantity of sulfur loaded. 2 vs 0.

And at this point when going upstream one can see that the quantity of water inside the water pipes is different. I think this is the root of all roundings that lead to such differences because it always happen with fluids.

I did a further test copy pasting not 1 time the blueprint here : https://factoriobin.com/post/oHv8SiWo but 50 times. All copy paste during time paused. Then i copied those 50 and made it a 100 . After some time the inserters positions when time paused was showing 3 different positions. with roughly 90% synced, 5% not synced pattern 1, and 5% not synced pattern 2 being the exact opposite of pattern 1.
There was no clear way to explain the location of the non-synced modules since they were not located similarly in the 50 first and in the 50 copy. ( inconsistent with my expectations ).

At this point i thought it would be easier to change the conditions of the trains that bring water and oil, and tell them to move away when their content drops under 100 and = 0. or add a condition for inactivty in a way that the excess quantity that cannot be unloaded is reset by the following refilling. It may be problematic for the oil more than for the water if you set up your refineries as independant modules for each wagons :( as again i'm afraid clocking the inserters blindly to what the chem plant are holding may cause a pile up in one of them that could cascade in a train not being able to fully unload and blocking everything. I'd let that "inactive" train go to refill.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2530
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by FuryoftheStars »

mmmPI wrote:
Thu May 26, 2022 7:46 am
FuryoftheStars wrote:
Thu May 26, 2022 3:34 am
I guess I'd have to see the whole setup in order to understand. I'm unfortunately unable to load up the game at this time, though.
https://www.youtube.com/watch?v=_Yge8YSGhnU

The several early copy paste are fine, but at 1 minute, the last of the copy paste behave differently than the others for no apparent reason, a noticeable difference in inserter timing while they should according to all expectations stay synchronized.

they are copy pasted on the same coordinates and inside the same chunk.
Yes, I did see that, but that doesn’t show the rest of the setup and thus why their being out of sync is an issue in the first place. And as you mentioned later in your post, it’s also difficult to see why/where the “desync” starts… is it with the inserters or something else before hand.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Fooluaintblack
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Oct 15, 2020 8:14 am
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Fooluaintblack »

FuryoftheStars wrote:
Thu May 26, 2022 3:34 am
They're distinct systems, but one is capable of robbing the sulfur from another?
Ah, I see what you mean. By "each pair of chem plants" I am referring to one sulfur chem plant and one sulfuric acid chem plant that form a pair. Each of these pairs (sulfur + acid) has a dedicated supply of water, petroleum, and iron plates. Even consumption is crucial because the input materials are supplied by trains, and the system is designed so trains must be empty before departing.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2530
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by FuryoftheStars »

Oh, ok. I also took another look at your initial image and I think I better understand now.

I have no idea what the stance of the devs on this is, but I know for me I’ve never built a setup expecting identical, perfect operation from everything. I always build planning on some level of unpredictability. :)
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Fooluaintblack
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Oct 15, 2020 8:14 am
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Fooluaintblack »

FuryoftheStars wrote:
Thu May 26, 2022 11:29 pm
I’ve never built a setup expecting identical, perfect operation from everything
Yeah, this sort of design is particularly useful for train-to-train bases. As Factorio is deterministic, creating synchronised systems is within reason. Still, this design philosophy may not be within "normal" expectations. Even so, the specific variance we've observed is unexpected. I suspect there may not be sufficiently important to get "fixed", but I would really like to understand the behaviour that occurs so I can predict and adapt to it.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2530
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by FuryoftheStars »

Fooluaintblack wrote:
Mon May 30, 2022 1:43 am
As Factorio is deterministic, creating synchronised systems is within reason.
While it is deterministic, it’s deterministic only in the sense that every player sees the same behavior, not that every iteration of the same setup sees the same behavior between each one.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

Fooluaintblack
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Oct 15, 2020 8:14 am
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by Fooluaintblack »

Fooluaintblack wrote:
Mon May 30, 2022 1:43 am
it’s deterministic only in the sense that every player sees the same behavior
Yes, I understand this. Still, large scale train-to-train bases with synchronised behaviour is not a novel idea; 10k SPM example, 20K SPM example. Regardless, I would still like to understand what it is that I need to design around.

mmmPI
Smart Inserter
Smart Inserter
Posts: 2728
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: [1.1.59] synchronised inserters fall out of sync while depositing items on belts

Post by mmmPI »

Fooluaintblack wrote:
Mon May 30, 2022 11:51 am
Regardless, I would still like to understand what it is that I need to design around.
I think one part of the trouble is because 2 inserter pick up the same thing (sulfur) from the same chemical plant. This is where the "order of update" matters, which one is going to pick up first ? if there is not enough sulfur for 2 inserters. This is not explicit in the game, it could be geometric, based on chunks, and position inside of chunk, but it would behave differently when blueprint are rotated or pasted in the middle of 2 chunks, it could also be based on which inserter was built first, but then some biters eating parts of the factory and robots rebuilding it would break the setup. I would advise designing around that because the mechanism of determination is fragile. ( take 10 modules, copy them, the 10 copy could behave differently than the 10 original based on non-explicit internal logic).

Another part is that understanding precisely the fluid dynamic inside pipes very difficult, and is made even more so because connected pipes also have their "order of update" that can sometimes impact the fluid propagation and create variance on identical modules. To make the matter worse, fluids quantities are really long number with hidden decimals and sometimes roundings could occurs. I would word it as one cannot easily avoid variance in itself, instead usually people avoid variance accumulating in a problematic location when dealing with trains.

Post Reply

Return to “Gameplay Help”