Page 1 of 1

[0.17.66] Crash on Lua error in on_chunk_generated

Posted: Sun Sep 01, 2019 8:46 am
by mrvn
I'm starting a new mod that needs a custom map on it's own surface. I did something wrong so when you press the "PB Editor" button and it starts to generate the map it gets a Lua error. But then the game crashes.
5514.184 Script @__PersistantBlueprints__/control.lua:169: map_chunk_generated([-96, -96]-[-64, -64])
terminate called after throwing an instance of 'ScriptEventException'
what(): The mod Persistant Blueprints caused a non-recoverable error.
Please report this error to the mod author.
Looks like the async map generation fails to catch Lua exceptions.

Re: [0.17.66] Crash on Lua error in on_chunk_generated

Posted: Sun Sep 01, 2019 8:58 am
by Klonan
Looks like its a mod problem:

Code: Select all

Error while running event PersistantBlueprints::on_chunk_generated (ID 12)
__PersistantBlueprints__/control.lua:188: attempt to index local 'entity' (a number value)
stack traceback:
	__PersistantBlueprints__/control.lua:188: in function <__PersistantBlueprints__/control.lua:156>
	[C]: in function 'force_generate_chunk_requests'
	__PersistantBlueprints__/control.lua:59: in function 'editor_init'
	__PersistantBlueprints__/control.lua:118: in function 'editor_button_clicked'
	__PersistantBlueprints__/control.lua:129: in function <__PersistantBlueprints__/control.lua:125
Moving to not a bug

Re: [0.17.66] Crash on Lua error in on_chunk_generated

Posted: Sun Sep 01, 2019 9:02 am
by Bilka
Klonan wrote: Sun Sep 01, 2019 8:58 am Looks like its a mod problem:
If you read the log, you will see that is showed "unexpected error", not the normal mod error dialog. However, I cannot reproduce this.

Re: [0.17.66] Crash on Lua error in on_chunk_generated

Posted: Sun Sep 01, 2019 9:16 am
by mrvn
I can reproduce it every time here.

Start factorio:

Code: Select all

   0.000 2019-09-01 11:11:45; Factorio 0.17.66 (build 46866, linux64, alpha)
   0.000 Operating system: Linux
   1.036 Checksum of PersistantBlueprints: 4126365630
Select Play -> Scenarios -> Sandbox -> Create -> Play

The sandbox starts. Press <tab> and click the "PB Editor" button.

The game crashes due to:

Code: Select all

surface.force_generate_chunk_requests()
Without that the normal mod error dialog is shown and the game survives the error in the mod.

Re: [0.17.66] Crash on Lua error in on_chunk_generated

Posted: Sun Sep 01, 2019 9:36 am
by Bilka
Even following those steps, I cannot reproduce the unexpected error.
Image

Re: [0.17.66] Crash on Lua error in on_chunk_generated

Posted: Sun Sep 01, 2019 10:34 am
by mrvn
Do you have multiple CPU cores? force_generate_chunk_requests() says it uses all threads so maybe it's a race condition which thread gets the LuaException first.

Re: [0.17.66] Crash on Lua error in on_chunk_generated

Posted: Sun Sep 01, 2019 11:42 am
by Jon8RFC
Windows 10 here. Couldn't get it to crash, but it had the same error as Bilka and booted me back to the main menu. I set all config thread options to 1 and set cpu affinity via cmd at launch to 1 core. It was noticeably slower to load the scenario map, but no crash. I forced the integrated gpu to do the rendering (still eventually passed through my dedicated gpu though) and still no crash. I don't have a linux machine to test on.