Page 1 of 1

Removal of Lua Functions while saving

Posted: Tue Jun 02, 2020 10:00 am
by Karoschl
While investigating a MP-desync I am experiencing, I noticed that the new saving method mentioned in the FF https://factorio.com/blog/post/fff-349 indicates that a lua function is being removed (as described in FF )
While trying to figure out which mod is causing this, i noticed that the log entry is rather "unhelpfull"

Code: Select all

1260.737 Info LuaHelper.cpp:4200: Removed 1 lua functions when saving
  • Is there a way for me to determine with lua, which functions are placed in global namespace and are candidates for removal?
  • I would suggest to make the logging in LuaHelper.cpp a bit more detailed...
Kind Regards

Re: Removal of Lua Functions while saving

Posted: Tue Jun 02, 2020 10:16 am
by boskid
Logging is not super verbose because it was helpful enough for me when testing how many mods will be broken, and with "Versobe logging" enabled this line shows directly before the log line which states how many bytes was saved and from which mod. It was originally intended to crash upon detection of functions but later i changed in into save-as-nil and added this log line. I do not want to log exact path to such functions because it would add extra operations on saving of every variable since i am using recursion to iterate over globals - on each call i would have to provide current path to the variable.

Simplest way to know which functions are candidate to be removed is to manually run `/c log(serpent.dump(global))`, every place which has "(loadstring or load)" is a candidate for removal (but there could be more than that). You may also implement your own globals traversal to catch all functions in it.

Re: Removal of Lua Functions while saving

Posted: Tue Jun 02, 2020 10:52 am
by Karoschl
Hi boskid,
thank you for your helpful and fast reply, it is always a pleasure to see how involved you guys are ! :!:

Verbose logging was a good pointer, i did not know this setting prior to this.
  • btw. - is there a way to enable verbose logging on a headless server?
Based on the log below, my first assumption was that the mod-even-distribution (14x) and mod-space-exploration (1x) had issues, but after removing mod-even-distribution it still says "Removed 14 lua functions when saving" (see second log fragment)

Thank you for your Time :-)

Kind Regards,
Karoschl

Code: Select all

  79.476 Applying migration: Base Mod: 2020-05-27_Factorio_0.18.28.lua
  79.479 Applying migration: AAI Industry: aai-industry.lua
  79.570 Info LuaGameScript.cpp:759: level state size: 340 bytes.
  79.570 Info LuaGameScript.cpp:759: mod-aai-industry state size: 72 bytes.
  79.570 Info LuaGameScript.cpp:759: mod-aai-signal-transmission state size: 2265 bytes.
  79.571 Info LuaGameScript.cpp:759: mod-Automatic_Train_Painter state size: 16434 bytes.
  79.572 Info LuaGameScript.cpp:759: mod-AutoTrash state size: 15852 bytes.
  79.572 Info LuaGameScript.cpp:759: mod-BigBags state size: 11 bytes.
  79.572 Info LuaGameScript.cpp:759: mod-blueprint_flip_and_turn state size: 11 bytes.
  79.572 Info LuaGameScript.cpp:759: mod-Clockwork state size: 73 bytes.
  79.572 Info LuaGameScript.cpp:759: mod-DeadlockResearchNotifications state size: 11 bytes.
  79.572 Info LuaGameScript.cpp:759: mod-even-distribution state size: 4508 bytes.
  79.573 Info LuaHelper.cpp:4200: Removed 14 lua functions when saving
  79.573 Info LuaGameScript.cpp:759: mod-Fill4Me state size: 58562 bytes.
  79.573 Info LuaGameScript.cpp:759: mod-FNEI state size: 16707 bytes.
  79.573 Info LuaGameScript.cpp:759: mod-FriendBlueprints state size: 11 bytes.
  79.573 Info LuaGameScript.cpp:759: mod-grappling-gun state size: 53 bytes.
  79.574 Info LuaGameScript.cpp:759: mod-informatron state size: 11 bytes.
  79.574 Info LuaGameScript.cpp:759: mod-inland_pumps state size: 135 bytes.
  79.574 Info LuaGameScript.cpp:759: mod-Inventory Sensor state size: 40712 bytes.
  79.582 Info LuaGameScript.cpp:759: mod-ixuBottleneck state size: 495549 bytes.
  79.587 Info LuaGameScript.cpp:759: mod-jetpack state size: 23 bytes.
  79.587 Info LuaGameScript.cpp:759: mod-LogiNetChannels state size: 140 bytes.
  79.587 Info LuaGameScript.cpp:759: mod-manual-inventory-sort state size: 174 bytes.
  79.597 Info LuaGameScript.cpp:759: mod-Mining_Drones state size: 752099 bytes.
  79.605 Info LuaGameScript.cpp:759: mod-ProgressiveRunning state size: 381 bytes.
  79.605 Info LuaGameScript.cpp:759: mod-RequestScanner state size: 52 bytes.
  79.606 Info LuaGameScript.cpp:759: mod-Rich_Text_Helper state size: 149270 bytes.
  79.606 Info LuaGameScript.cpp:759: mod-robot_attrition state size: 643 bytes.
  79.606 Info LuaGameScript.cpp:759: mod-showTileGridLite state size: 11 bytes.
  79.606 Info LuaGameScript.cpp:759: mod-some-luaconsole state size: 11 bytes.
  79.606 Info LuaGameScript.cpp:759: mod-space-exploration-graphics state size: 11 bytes.
  79.607 Info LuaGameScript.cpp:759: mod-Teleporters state size: 184 bytes.
  79.607 Info LuaGameScript.cpp:759: mod-VehicleSnap state size: 311 bytes.
  79.607 Info LuaGameScript.cpp:759: mod-WhereIsMyBody state size: 22 bytes.
  79.607 Info LuaGameScript.cpp:759: mod-automatic-station-painter state size: 16861 bytes.
  79.639 Info LuaGameScript.cpp:759: mod-factoryplanner state size: 3485191 bytes.
  79.641 Info LuaGameScript.cpp:759: mod-LightedPolesPlus state size: 763 bytes.
  79.644 Info LuaGameScript.cpp:759: mod-LogisticTrainNetwork state size: 411511 bytes.
  79.645 Info LuaGameScript.cpp:759: mod-Dectorio state size: 60 bytes.
  79.645 Info LuaGameScript.cpp:759: mod-LTN_Combinator state size: 25511 bytes.
  79.648 Info LuaGameScript.cpp:759: mod-LTN_Content_Reader state size: 284984 bytes.
  79.654 Info LuaGameScript.cpp:759: mod-space-exploration state size: 666930 bytes.
  79.655 Info LuaHelper.cpp:4200: Removed 1 lua functions when saving
  79.655 Info LuaGameScript.cpp:759: mod-Krastorio2 state size: 8250 bytes.
  79.655 Info LuaGameScript.cpp:759: mod-LandfillEverything state size: 11 bytes.
  79.657 Info LuaGameScript.cpp:759: mod-LtnManager state size: 238216 bytes.
  79.657 Info LuaGameScript.cpp:759: mod-Long-Train-warehouses state size: 11 bytes.
  79.664 Info LuaGameScript.cpp:759: mod-Transport_Drones state size: 612325 bytes.
  79.666 Info LuaGameScript.cpp:759: mod-Mod-Fixer state size: 11 bytes.
  79.737 Checksum for script C:/Users/[...]/AppData/Roaming/Factorio/temp/currently-playing/control.lua: 3138768633

Code: Select all

  72.659 Applying migration: Base Mod: 2020-05-27_Factorio_0.18.28.lua
  72.662 Applying migration: AAI Industry: aai-industry.lua
  72.739 Info LuaGameScript.cpp:759: level state size: 340 bytes.
  72.739 Info LuaGameScript.cpp:759: mod-aai-industry state size: 72 bytes.
  72.739 Info LuaGameScript.cpp:759: mod-aai-signal-transmission state size: 2265 bytes.
  72.740 Info LuaGameScript.cpp:759: mod-Automatic_Train_Painter state size: 16434 bytes.
  72.741 Info LuaGameScript.cpp:759: mod-AutoTrash state size: 15852 bytes.
  72.741 Info LuaGameScript.cpp:759: mod-BigBags state size: 11 bytes.
  72.741 Info LuaGameScript.cpp:759: mod-blueprint_flip_and_turn state size: 11 bytes.
  72.741 Info LuaGameScript.cpp:759: mod-Clockwork state size: 73 bytes.
  72.741 Info LuaGameScript.cpp:759: mod-DeadlockResearchNotifications state size: 11 bytes.
  72.741 Info LuaHelper.cpp:4200: Removed 14 lua functions when saving
  72.741 Info LuaGameScript.cpp:759: mod-Fill4Me state size: 58562 bytes.

Re: Removal of Lua Functions while saving

Posted: Tue Jun 02, 2020 10:58 am
by boskid
In both cases it points to "Fill4Me" mod. Log line about deleted functions is before a line where mod state size is printed.

You may run `/c __Fill4Me__ log(serpent.dump(global))` to run such command under that mods context to check where it has functions in it.

-- edit: with Krastorio2 you may safely ignore info line, there was 1 function related to flying texts that was crashing when calling nil function and is now fixed by Krastorio2 0.9.19.

Re: Removal of Lua Functions while saving

Posted: Tue Jun 02, 2020 11:34 am
by Karoschl
It was indeed fill4me that caused my issues and the desync.
Disabling it resolved everything for me... as it is only a QoL mod I'll just post a bug report in the mod portal and leave it disabled for now.

Thank you for helping me understand factorio a bit better. I hope this post will be helpful for others with similar issues !
Have a nice day :-)

Kind regards,
Karoschl