Page 1 of 1

[0.16.35] Factorio deadlocks ingame, SP, no mods

Posted: Tue Mar 27, 2018 10:21 pm
by luziferius
Well,
This might be 1/0 magic…
I got a deadlock. Rendering stops. Simulation stops (CPU load drops to 13% of a single core.). Autosaves stop being saved.

It now happened the second time, the first time was several versions ago, but I don’t remember which 0.16.x version that was.

After I got the deadlock, I attached gdb to the factorio PID and dumped backtraces using thread apply all bt, included in gdb.txt

(I needed 2 attempts to attach gdb to factorio. During the first attempt, gdb hang after running attach. I hope that killing gdb and then attaching another instance did not destroy the gathered backtraces.)

If this deadlock happens again, what can I do to produce more useful debug output?
log
Backtraces generated using gdb

Re: [0.16.35] Factorio deadlocks ingame, SP, no mods

Posted: Tue Mar 27, 2018 10:57 pm
by kitcat
Tried running Factorio without Steam?

Re: [0.16.35] Factorio deadlocks ingame, SP, no mods

Posted: Tue Mar 27, 2018 11:25 pm
by luziferius
This does not happen often and I have not found any reproduction steps.
The steam version runs fine for days worth of play time, so its not that I can't play because of this.

I thougth about it a bit more: It might be a lock in the graphics driver caused by
some weird interactions between Factorio, the nvidia linux driver, maybe my lowlatency kernel and the Steam game overlay.

What happens to a singleplayer game when the render thread(s) deadlock? Does the simulation still advance or does it stall?

I'd like to try that, so how can I deliberately stall the render thread?

Re: [0.16.35] Factorio deadlocks ingame, SP, no mods

Posted: Wed Mar 28, 2018 8:56 am
by Rseding91
luziferius wrote:What happens to a singleplayer game when the render thread(s) deadlock? Does the simulation still advance or does it stall?

I'd like to try that, so how can I deliberately stall the render thread?
It depends what part: if the prepare step locks then the entire program will pause waiting for it. If the render thread (send draw calls to the GPU) locks then the game keeps updating in the background.

Re: [0.16.35] Factorio deadlocks ingame, SP, no mods

Posted: Wed Mar 28, 2018 8:56 am
by Rseding91
Based off your comments and having no way to reproduce this I'm going to move it to 0/1 magic.

Re: [0.16.35] Factorio deadlocks ingame, SP, no mods

Posted: Wed Mar 28, 2018 7:08 pm
by luziferius
I hope that this will resolve itself when the renderer rewrite hits in 0.17.

When only render deadlocks, then the game should therefore continue doing autosaves. Since that stopped (huge time diff in log without saves), I conclude it was the prepare step.

If this happens again, would a full memory dump be helpful?

Re: [0.16.35] Factorio deadlocks ingame, SP, no mods

Posted: Wed Mar 28, 2018 7:46 pm
by eradicator
Factorio stops when the stdout is blocked and it tries to save. This is easily reproducable by starting factorio from console on windows and then selecting some text. I never considered this a bug but it at least somewhat fits the pattern you describe: "doesn't save" and "cpu usage drops", though cpu usage drops to nearly 0 for me in that case. (I use this to stop factorio from using cpu without having to restart it, sort of a factorio built-in "hybernate" function. Because even in menus/pause mode it consumes lots and lots of tasty cpu cycles and heats up my laptop.)