[0.17.68] Desync with mod caused by different serialization order

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

[0.17.68] Desync with mod caused by different serialization order

Post by Therenas »

I'm the author of the mod Factory Planner, and I just got a desync report from a user. He took a look at the desync report and noticed that the difference was not with the actual data, but with the order that it was saved in. I'm no good at interpreting desync reports, but I don't know how a mod can affect the serialization order of lua tables. I'd like to think it shouldn't be able to, but I don't know, maybe I'm missing something.

The desync reports are linked in the discussion thread. I investigated my code and I'm pretty sure I don't do any of the typical desync-causing stuff, like modifying global during on_load, or using read/write lua-global variables.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.68] Desync with mod caused by different serialization order

Post by Rseding91 »

Thanks for the report. The script contents may be different and there may be a bug around that logic but the desync itself is never triggered due to the contents of the script file. The desync is always triggered by what's different in level-heuristic.dat.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5150
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.17.68] Desync with mod caused by different serialization order

Post by Klonan »

The heuristic shows some diff in the number of active entities

Well, I am going to move this to desyncs with mods

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: [0.17.68] Desync with mod caused by different serialization order

Post by Deadlock989 »

I was paranoid that this was being caused by my mod, so I did some poking.

The only diff in the heuristics (which I barely understand) is on line 626, it mentions trains and active entities. My mod doesn't create or destroy any entities via scripting.

The report came from folks who were running a pack that includes the mod Electric Train. Looking at that mod's control.lua, it seems that it does use two local variables (i.e. defined outside of all functions, not in the global table) that are used by several functions, and it does create and destroy trains based on the values of those variables. Presumably any player that left and then returned would end up with different values.

I don't know that much about desyncs in Factorio but this seems like a good place to start.
Image

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: [0.17.68] Desync with mod caused by different serialization order

Post by Therenas »

Well, that should put it to bed. Thanks again Deadlock. I just was kind of paranoid because I got two desync reports in two days, with both not being my fault after all. Sorry to bother.

Post Reply

Return to “Resolved Problems and Bugs”