[0.7.1] crash when returning from the lock screen

This subforum contains all the issues which we already resolved.
LoSboccacc
Filter Inserter
Filter Inserter
Posts: 253
Joined: Wed Feb 20, 2013 9:35 pm
Contact:

[0.7.1] crash when returning from the lock screen

Post by LoSboccacc »

this is extremely specific case

on windows 8 64bit - intel cpu, nvidia mobile gpu
when the screen saver starts, when I unlock the pc the game crashes.

happens 100% of the time.

if I alt+tab back and forth, it doesn't crash

if I alt+tab and the screen locks, at the return it doesn't crash.

only happens when in fullscreen.
SilverWarior
Filter Inserter
Filter Inserter
Posts: 559
Joined: Mon Mar 04, 2013 9:23 am
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by SilverWarior »

I would gues that Factorio doesn't handle losing of Display device correctly.
You see when in Windows Vista or newer your computer which have both integrated and dedicated graphic card locks the dedicated graphic card is powered off for power savings.
This results in any programs that were using it to lose handle to grapgical drivers. So such program must be developed in a way that it can reinitialize its graphical engine at any time and of course be able to run without graphical engine initialized if you want for gameplay to progress.
Most games just monitor system messages to figure out when computer will go in such power saving mode and simply puse the game. And then when computer resumes from such mode they reinitialize the graphical engine and alow you to continue playing.
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by kovarex »

Factorio handles loosing display (It wouldn't work when you alt tab otherwise).
But for some reason, this kind of loosing display is different kind of event, I will take a look at it.
SilverWarior
Filter Inserter
Filter Inserter
Posts: 559
Joined: Mon Mar 04, 2013 9:23 am
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by SilverWarior »

kovarex wrote:Factorio handles loosing display (It wouldn't work when you alt tab otherwise).
But for some reason, this kind of loosing display is different kind of event, I will take a look at it.
When you handle ALT+TAB you only handle computer going from FullScreen mode to Desktop mode and vice versa or in case of two graphics adapter swhitching between two of them. But un such case none of the graphics cards ever gets powered down.
Well based on system settings dedicated graphics card will get powered down after some time of inactivity but usually games in bacground can still prevent that.

But when system gets locked dedicated graphics card almost always gets powered down even if some application might be still using it. This results in loss of Display Device Handle. So if graphical engine does not verify Display Device Handle validity before executing any draw commands the aplication will most likely cause Access Violation.


So best solutions for such scenario are folowing:
1. Graphical engine checks that Display Device Handle is valid before it starts drawing each frame. You would probably need to modify graphical engine for this so this option might not be suitable for you.
2. Your game regulary check system messages about it goung into any power saving mode to handle each situation acordingly. This approach can be especially usefull for making your game "Laptop friendly" becouse by monitoring such messages you can also know if computer might try to shut down due to low battery power and such.
Psycho0124
Fast Inserter
Fast Inserter
Posts: 101
Joined: Sat Oct 12, 2013 3:46 am
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by Psycho0124 »

Hey, I've been getting this in Win7 x64 for the last few versions too when returning from the lock screen.
I run dual monitors on a Geforce 660Ti and occasionally have programs that crash/behave badly with both monitors enabled.
On a hunch, I disabled my 2nd monitor and let it go into lock mode. Factorio didn't crash when I logged back in!

This may be an issue with multi-monitor setups. LoSboccacc, you wouldn't happen to have a second monitor connected to your laptop would you? Enabling the "Force TV Detection" setting on an unconnected S-Video port might also count as a second display to your GPU.
Last edited by Psycho0124 on Sun Oct 27, 2013 6:13 pm, edited 1 time in total.
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by kovarex »

I have two monitors, I can try it.
LoSboccacc
Filter Inserter
Filter Inserter
Posts: 253
Joined: Wed Feb 20, 2013 9:35 pm
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by LoSboccacc »

did a bit more testing and this is the situation

I never had a second monitor
If I lock the screen and/or wait for the screensaver, no crash
if I wait till the display sleep and immediately resume, no crash

so, it only happens after the display enters yet another state that it is more than sleep.

on a specific note, I do have a peculiar setup, with an optimus nvidia system on a laptop, with the automatic switching between cards off.
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by kovarex »

Hello, this should be fixed for 0.10.9
User avatar
SHiRKiT
Filter Inserter
Filter Inserter
Posts: 706
Joined: Mon Jul 14, 2014 11:52 pm
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by SHiRKiT »

Really? I can finally hibernate my PC with Factorio running? =D
kovarex
Factorio Staff
Factorio Staff
Posts: 8298
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.7.1] crash when returning from the lock screen

Post by kovarex »

SHiRKiT wrote:Really? I can finally hibernate my PC with Factorio running? =D
Well we have a fix and I tested that it works for me, but ofcourse I can never guarantee that it will work on your computer, let me know when 0.10.9 is released :)
Post Reply

Return to “Resolved Problems and Bugs”