Page 1 of 1

[0.12.33] crash after server_save

Posted: Wed May 18, 2016 7:40 am
by binbinhfr
Hi there,

During the writing of my new mod, I had a strange repeted crash after a game.server_save under MP with 1 or 2 players and 1 headless server.
Here is the simple map and the report.
I can send you the mod by MP with a little explanation on what do do to trigger the crash.
Basically, it call a game.server_save() and then try the reconstruct some parts of my gui to display a report.
I tried using pcall(game.server_save) which shows that the save works (I see it on the time stamp of the saved file).
It is the GUI reconstruction just after the save that creates the crash. This same GUI triggers no problems for the rest of the mod, but does not do anything special after this game.server_save .

Note that my mod does not seem to trigger any desync either.

log with 1 player + 1 server :
factorio-current.log
(10.65 KiB) Downloaded 136 times
log with 2 players + 1 server :
factorio-current2.log
(15.21 KiB) Downloaded 157 times

Re: [0.12.33] crash after server_save

Posted: Wed May 18, 2016 8:11 am
by Rseding91
using pcall when calling save is a good way to *completely* screw the game state - don't do that.

Your actual issue is in the log file:
15.185 Error MultiplayerManager.cpp:110: MultiplayerManager failed: "Error while running the event handler: __MayTheForceBeWithYou__/control.lua:1244: unknown flow GuiDirection value: "

Re: [0.12.33] crash after server_save

Posted: Wed May 18, 2016 8:32 am
by binbinhfr
I use pcall to avoid error in solo mode. What else can I do ?
It was a conclusion of this thread :
viewtopic.php?f=25&t=25115

Anyway, the crash does still appear without any pcall at all (for testings I removed them from the whole mod).

And the error message concerning Gui direction is somewhat random, as I did not use any direction on a flow.
Note in the second log, that the error message is different. I send you a third log here with another message.

Infact the GUI window reconstruction function that I use after the save is used in many other situation without problem. And the save does not change anything in the GUI reconstruction. But it seems that triggering these GUI calls after the save creates a problem (even if they work in all other situations).

I send you the mod in MP.

To trigger the error, you have to run a headless server and connect with a player (it does not work with a simple MP load).
just directly click on the head button in the upleft corner, to open the interface, then click on server-save.

The basic call is in control.lua, line 406, then the info() function is called, that call window_update() to refresh the whole GUI and display a message.

Note that the error message can be different if I comment a few lines in the mod.

Re: [0.12.33] crash after server_save

Posted: Wed May 18, 2016 10:39 am
by Rseding91
Fun... so the "server_save" is actually broken as it is now :) It starts saving the map and then returns to the Lua code and allows it to keep executing while the save runs and it definitely should not be doing that.

Re: [0.12.33] crash after server_save

Posted: Wed May 18, 2016 11:23 am
by binbinhfr
Rseding91 wrote:Fun... so the "server_save" is actually broken as it is now :) It starts saving the map and then returns to the Lua code and allows it to keep executing while the save runs and it definitely should not be doing that.
So you confirm it's a little bug ?
Maybe I am the first modder to include it into its mod ? :-)

By the way, you did not tell me how to avoid error in solo without using pcall on server_save ?

Re: [0.12.33] crash after server_save

Posted: Wed May 18, 2016 2:06 pm
by Oxyd
Fixed in 0.12.24.

Re: [0.12.33] crash after server_save

Posted: Wed May 18, 2016 2:37 pm
by binbinhfr
Oxyd wrote:Fixed in 0.12.24.
Do you mean 0.12.34, or do you mean it was fixed in the past and then unfixed ??? :-)

No answer on the pcall(game.server_save) ? Why shouldn't it be safe ?