[0.18.32] Crash to desktop when resuming autosave under debugger.

This subforum contains all the issues which we already resolved.
Post Reply
User avatar
mrudat
Fast Inserter
Fast Inserter
Posts: 229
Joined: Fri Feb 16, 2018 5:21 am
Contact:

[0.18.32] Crash to desktop when resuming autosave under debugger.

Post by mrudat »

What did you do?
Started Factorio under the debugger to check to see if the mod I'm updating works as designed.

Tried to resume the latest autosave.
What happened?
Factorio crashed to desktop.
What did you expect to happen instead?
Perhaps an error message of some sort saying that this chunk of Lua did something silly?
Attachments
mods.7z
all of the mods I've unpacked, and possibly edited.
(2.36 MiB) Downloaded 52 times
_autosave1.zip
the save I tried to load.
(3.46 MiB) Downloaded 56 times
Factorio-Roboport-Radar.7z
the mod I was trying to test.
(38.11 KiB) Downloaded 52 times
factorio-dump-current.dmp
(847.76 KiB) Downloaded 53 times
factorio-current.log
(39.98 KiB) Downloaded 54 times

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2242
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [0.18.32] Crash to desktop when resuming autosave under debugger.

Post by boskid »

I can easily reproduce this issue by having a save file that has control.lua:

Code: Select all

setmetatable(_G, {__index=function()assert(false)end})
log=nil
However i am not considering this to be worth fixing. Overwriting log function is not allowed and will throw "Detected modification of the global 'log' function.". Overwriting log function and then setting metatable over _G (or _ENV as jarg would said) and throwing when trying to access log results in such crash.

justarandomgeek
Filter Inserter
Filter Inserter
Posts: 300
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: [0.18.32] Crash to desktop when resuming autosave under debugger.

Post by justarandomgeek »

I'll dig into this more shortly, but yes, it is almost certainly caused by the debugger doing a little bit of evil to convert log() calls to debug console events with clickable links to source. You can disable this functionality for now by setting

Code: Select all

"hookLog": false
in your launch.json, which should allow it to work as-is. I suspect when i get to looking it will turn out that one or more of these mods is setting a metatable on _ENV/_G without checking if there's already one, and possibly even directly overwriting the parts of it that the debugger uses for various functionality (such as sorting all the builtin globals out of sight when you don't want them cluttering up Variables view).

User avatar
mrudat
Fast Inserter
Fast Inserter
Posts: 229
Joined: Fri Feb 16, 2018 5:21 am
Contact:

Re: [0.18.32] Crash to desktop when resuming autosave under debugger.

Post by mrudat »

Good enough for me.

Thanks for looking into it. =)

justarandomgeek
Filter Inserter
Filter Inserter
Posts: 300
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: [0.18.32] Crash to desktop when resuming autosave under debugger.

Post by justarandomgeek »

Minor follow up now that this is in resolved: We've changed the way the debugger `log()` hook works to no longer allow constructing this crash with the latest factorio(0.18.34) and debugger(0.18.25) when both are updated (if either is old it'll still use the old way).

Post Reply

Return to “Resolved Problems and Bugs”