Blecki / dwarfcorp

An open-source 3D colony management game for PC, Mac and Linux
http://www.dwarfcorp.com
Other
580 stars 71 forks source link

Low Repro Crash: Purple Screen of Death while starting advanced game - Terrain2D #953

Open com1clyf3 opened 6 years ago

com1clyf3 commented 6 years ago

Very likely a variation of #952, but this particular crash happened in Terrain.

Occurred using same repro of #952.

    Microsoft.Xna.Framework.dll!Microsoft.Xna.Framework.Helpers.CheckDisposed(object obj, System.IntPtr pComPtr)    Unknown
    Microsoft.Xna.Framework.Graphics.dll!Microsoft.Xna.Framework.Graphics.TextureCollection.this[int].set(int index, Microsoft.Xna.Framework.Graphics.Texture value)    Unknown
    Microsoft.Xna.Framework.Graphics.dll!Microsoft.Xna.Framework.Graphics.SpriteBatch.RenderBatch(Microsoft.Xna.Framework.Graphics.Texture2D texture, Microsoft.Xna.Framework.Graphics.SpriteBatch.SpriteInfo[] sprites, int offset, int count) Unknown
    Microsoft.Xna.Framework.Graphics.dll!Microsoft.Xna.Framework.Graphics.SpriteBatch.Flush()   Unknown
    Microsoft.Xna.Framework.Graphics.dll!Microsoft.Xna.Framework.Graphics.SpriteBatch.End() Unknown
>   DwarfCorp.exe!DwarfCorp.Terrain2D.Draw(Microsoft.Xna.Framework.Graphics.GraphicsDevice graphics, DwarfCorp.DwarfTime time) Line 300 C#
    DwarfCorp.exe!DwarfCorp.Terrain2D.Render(Microsoft.Xna.Framework.Graphics.GraphicsDevice graphics, DwarfCorp.DwarfTime time) Line 165   C#
    DwarfCorp.exe!DwarfCorp.GameStates.GameStateManager.Render(DwarfCorp.DwarfTime time) Line 132   C#
    DwarfCorp.exe!DwarfCorp.DwarfGame.Draw(Microsoft.Xna.Framework.GameTime time) Line 612  C#
    Microsoft.Xna.Framework.Game.dll!Microsoft.Xna.Framework.Game.DrawFrame()   Unknown
    Microsoft.Xna.Framework.Game.dll!Microsoft.Xna.Framework.Game.Tick()    Unknown
    Microsoft.Xna.Framework.Game.dll!Microsoft.Xna.Framework.Game.HostIdle(object sender, System.EventArgs e)   Unknown
    Microsoft.Xna.Framework.Game.dll!Microsoft.Xna.Framework.GameHost.OnIdle()  Unknown
    Microsoft.Xna.Framework.Game.dll!Microsoft.Xna.Framework.WindowsGameHost.RunOneFrame()  Unknown
    Microsoft.Xna.Framework.Game.dll!Microsoft.Xna.Framework.WindowsGameHost.ApplicationIdle(object sender, System.EventArgs e) Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(int grfidlef)    Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(System.IntPtr dwComponentID, int reason, int pvLoopData)  Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(int reason, System.Windows.Forms.ApplicationContext context)    Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop(int reason, System.Windows.Forms.ApplicationContext context) Unknown
    System.Windows.Forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm)   Unknown
    Microsoft.Xna.Framework.Game.dll!Microsoft.Xna.Framework.WindowsGameHost.Run()  Unknown
    Microsoft.Xna.Framework.Game.dll!Microsoft.Xna.Framework.Game.RunGame(bool useBlockingRun)  Unknown
    DwarfCorp.exe!DwarfCorp.Program.Main(string[] args) Line 88 C#

Output:

'DwarfCorp.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\kingofarabi1\Source\Repos\dwarfcorp\DwarfCorp\DwarfCorpXNA\bin\x86\Release\DwarfCorp.exe'. Symbols loaded.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Game\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Game.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Users\kingofarabi1\Source\Repos\dwarfcorp\DwarfCorp\DwarfCorpXNA\bin\x86\Release\Steamworks.NET.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Graphics\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Graphics.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Users\kingofarabi1\Source\Repos\dwarfcorp\DwarfCorp\DwarfCorpXNA\bin\x86\Release\SharpRaven.dll'. Symbols loaded.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Xna.Framework.Input.Touch\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Input.Touch.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Users\kingofarabi1\Source\Repos\dwarfcorp\DwarfCorp\DwarfCorpXNA\bin\x86\Release\Newtonsoft.Json.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll'. Cannot find or open the PDB file.
Auto Reset Float Setting: Boredom_Gamble to -10
Auto Reset Float Setting: Boredom_NormalTask to 0.1
Auto Reset Float Setting: Boredom_Sleep to -0.1
Auto Reset Float Setting: Boredom_ExcitingTask to -0.1
Auto Reset Float Setting: Boredom_BoringTask to 0.5
Auto Reset Float Setting: Boredom_Eat to -0.1
Auto Reset Float Setting: Boredom_Walk to -0.2
Loaded settings C:\Users\kingofarabi1\AppData\Roaming\DwarfCorp\settings.json
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Xact\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Xact.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Xna.Framework.GamerServices\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.GamerServices.dll'. Cannot find or open the PDB file.
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Users\kingofarabi1\Source\Repos\dwarfcorp\DwarfCorp\DwarfCorpXNA\bin\x86\Release\LibNoise.dll'. Symbols loaded.
The thread 0x29f8 has exited with code 0 (0x0).
'DwarfCorp.exe' (CLR v4.0.30319: DwarfCorp.exe): Loaded 'C:\Users\kingofarabi1\Source\Repos\dwarfcorp\DwarfCorp\DwarfCorpXNA\bin\x86\Release\YarnSpinner.dll'. Module was built without symbols.
The thread 0x39b8 has exited with code 0 (0x0).
Exception thrown: 'System.Threading.ThreadAbortException' in mscorlib.dll
The thread 0x1ec0 has exited with code 0 (0x0).
The thread 0x3b5c has exited with code 0 (0x0).
Exception thrown: 'System.Threading.ThreadAbortException' in mscorlib.dll
The thread 0x2958 has exited with code 0 (0x0).
The thread 0x2654 has exited with code 0 (0x0).
The thread 0xea8 has exited with code 0 (0x0).
Exception thrown: 'System.ObjectDisposedException' in Microsoft.Xna.Framework.dll
Exception thrown: 'System.ObjectDisposedException' in Microsoft.Xna.Framework.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.Xna.Framework.Graphics.dll
Exception thrown: 'System.ObjectDisposedException' in Microsoft.Xna.Framework.dll
Exception thrown: 'System.InvalidOperationException' in Microsoft.Xna.Framework.Graphics.dll
Exception thrown: 'System.ObjectDisposedException' in Microsoft.Xna.Framework.dll

image

cf5eaf96

mklingen commented 6 years ago

I swear I fixed this last night... will try to reproduce again.

mklingen commented 6 years ago

random crashes unfortunately will still occur at load time if the graphics device is disposed, due to a lot of stuff happening in the loading thread. I'm going to maybe try moving some of that stuff to the main play state.

mklingen commented 6 years ago

Okay, so I went ahead and did a testing grind with "graphics device lost during game load time" and fixed a few dozen crashes. This is something the engine was never meant to handle, so there are still going to be corner cases, but I've gotten the most egregious of them. For one, there were a few systems that assumed that they could load all their assets at startup and never touch them again (sky renderer, water renderer, indiciators, etc.). I broke them of this assumption and they're much more robust now.