deserialization error ?

Bugs that are actually features.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

deserialization error ?

Post by binbinhfr »

Hi,

running one of my mod, a user have this strange message that I cannot reproduce, but which is related to my mod, because force_mem is my variable.
Code: Select all
Error while running deserialization: [string "do local _={ticks=87,enabled=true,force_mem={..."]:1: too many C levels (limit is 200) in main function near "802384732948701238470123""
thread with user explanation : viewtopic.php?f=92&t=29179&p=187057#p187045

any idea ?
My mods on the Factorio Mod Portal :geek:
Rseding91
Factorio Staff
Factorio Staff
Posts: 16423
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: deserialization error ?

Post by Rseding91 »

Are you storing entity references as keys? If so, don't do that. The serpent library we use that saves the Lua state doesn't work correctly and you end up with this type of error.
If you want to get ahold of me I'm almost always on Discord.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: deserialization error ?

Post by binbinhfr »

Rseding91 wrote:Are you storing entity references as keys? If so, don't do that. The serpent library we use that saves the Lua state doesn't work correctly and you end up with this type of error.
Do you mean using a table indexed directly on entities ?

I store several complex tables but only indexed by names
a table of forces by force names
a table of recipes by recipe names
a table a items/fluids by names

these tables can have entity as members, or even other tables or lists, or references to other objects in another table.
I also store references to GUI elements.

I checked my code but did not remember using entity as a direct index, not even entity.unit_number.

Another idea ?
My mods on the Factorio Mod Portal :geek:
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: deserialization error ?

Post by binbinhfr »

EDIT : the user send me the map ans the mods here https://wsi.li/avdqzY1a509N
I confirm the problem. But cannot track it... Do you have other way to be more precise in what I do wrong in my EfficienSee mod ? What variable is in problem ?
The force_mem variable of the error message is a table indexed by force names. It contains several other big tables, indexed by strings or not indexed too.
My mods on the Factorio Mod Portal :geek:
Rseding91
Factorio Staff
Factorio Staff
Posts: 16423
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: deserialization error ?

Post by Rseding91 »

Well, the script.dat file is 370 MB so what ever you're doing in the mod is storing too much data in the global table.
If you want to get ahold of me I'm almost always on Discord.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16423
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: deserialization error ?

Post by Rseding91 »

Yeah, it's the mod "EfficienSee". What ever you did in the mod is just wrong - 370 MB of lua tables in the save file is around 368~ MB too much.
If you want to get ahold of me I'm almost always on Discord.
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1525
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Re: deserialization error ?

Post by binbinhfr »

Well yes, as I try to keep track of all statistics of the factory, it's too much.
I will have to forget about this approach and propose something more simple...
My mods on the Factorio Mod Portal :geek:
wvlad
Fast Inserter
Fast Inserter
Posts: 219
Joined: Thu Jul 13, 2017 9:55 pm
Contact:

Re: deserialization error ?

Post by wvlad »

Devs, can you please add to the docs that entities should not be stored in global.sometable as table keys? I've just encountered this issue myself.
Post Reply

Return to “Not a bug”