[1.1.109] Crash on creating Lua context when loading a save

This subforum contains all the issues which we already resolved.
curiosity
Filter Inserter
Filter Inserter
Posts: 471
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

[1.1.109] Crash on creating Lua context when loading a save

Post by curiosity »

To reproduce:
1. Install my local mod versions, in addition to what you can download from the portal.
2. Try loading the save.

Alas, I didn't think to save the original log, so all you get is a log of me launching Factorio and trying to load the save. FWIW, all three of my autosaves are broken like this, so, whatever it is, it happened more than 10 minutes before this save was made.
Attachments
factorio-current.log
(24.86 KiB) Downloaded 71 times
_autosave3.zip
(11.03 MiB) Downloaded 52 times
Last edited by curiosity on Wed Aug 14, 2024 10:06 pm, edited 1 time in total.
curiosity
Filter Inserter
Filter Inserter
Posts: 471
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: [1.1.109] Crash on creating Lua context when loading a save

Post by curiosity »

What I would like to know is what in the mod data is causing the crash, so hopefully I could do something about it. I tried GDB, but it's impenetrable. GDB is not intended to be used without source code. Based on 12 downloads, I assume that someone has looked at this.
DarkShadow44
Filter Inserter
Filter Inserter
Posts: 355
Joined: Thu Jun 01, 2017 12:05 pm
Contact:

Re: [1.1.109] Crash on creating Lua context when loading a save

Post by DarkShadow44 »

curiosity wrote: Wed Aug 14, 2024 6:49 pm Based on 12 downloads, I assume that someone has looked at this.
Possibly just curious people like me. Anyways, I'm on Arch Linux and confirm the issue. It works if you remove the "factoryplanner-curiosity" mod, and crashes if you have ONLY the "factoryplanner-curiosity" mod.

Figuring out what crashes is easy, you just remove stuff until it works, pinpointing the exactly line it fails at.

Stack trace in lua is
- control.lua:3 - require("__factoryplanner-curiosity__/data/init.lua")
- data/init.lua:6 - Player = require('__factoryplanner-curiosity__/classes/model/Player.lua')
- classes/model/Player.lua:7 - local Library = require('__factoryplanner-curiosity__/classes/model/Library.lua')
- classes/model/Library.lua:6 - local Notifier = require('__factoryplanner-curiosity__/classes/Notifier.lua')
- classes/Notifier.lua:5 - local WeakTable = require('__factoryplanner-curiosity__/classes/WeakTable')
- classes/WeakTable:4 - script.register_metatable('WeakKeyTable', wk_mt)
- Crash in factorio code

I don't know anything about metatables, so I can't help. I don't have source access either, so you probably need a dev to have a look.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3025
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.109] Crash on creating Lua context when loading a save

Post by boskid »

Issue was identified and is fixed for 2.0.

Please do not use weak tables inside of `global` (classes/Notifier.lua, Notifier.subscribe calls WeakTable.with_keys())
curiosity
Filter Inserter
Filter Inserter
Posts: 471
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: [1.1.109] Crash on creating Lua context when loading a save

Post by curiosity »

boskid wrote: Wed Aug 14, 2024 8:05 pm Issue was identified and is fixed for 2.0.

Please do not use weak tables inside of `global` (classes/Notifier.lua, Notifier.subscribe calls WeakTable.with_keys())
Thanks for the info. Fixed how? A proper error is displayed or weak tables are supported?
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3025
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.109] Crash on creating Lua context when loading a save

Post by boskid »

In 2.0 it will work fine with weak tables. Not using weak tables in 1.1 is just a workaround.
curiosity
Filter Inserter
Filter Inserter
Posts: 471
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: [1.1.109] Crash on creating Lua context when loading a save

Post by curiosity »

Version 1.1.110 wrote: Fri Aug 16, 2024 5:09 pm
  • Fixed a crash when using weak tables in the lua global table. (114713)
That came quicker than anticipated. Thank you.
Post Reply

Return to “Resolved Problems and Bugs”