Build crashes but keeps running

Hi guys,

this is my first time on this forums, I didn’t find any “read before posting” topic so I hope I won’t break any rule by posting my question here. I’m running trough some issues with my built app. Sometimes it crashes when starting (and never later). When it crashes, the common “Oops the game crashed” window pops but the funny thing is that when I move away this window without pressing OK, I can keep playing and everything goes fine.

You’ll find more information on my problem here : http://answers.unity3d.com/questions/984552/unfrequent-crash.html

I hope there is no problem posting here to draw your attention on a topic from UnityAnswers.

You have to be more specific, what platform is this, also did you check the player log?

Hi ! You can find most information on the link I putted in my first post but here is what I can say :
I’m building my app in Standalone Windows 32 using Unity 4.6.6f2. The app crashes on the following PC (but not only) : Windows 7 x64, Intel Xeon E5-1620, GeForce 670GTX, 12Gb RAM. All drivers are up to date.

So long story short, one of our clients reported unfrequent crashes with this app. The crash always occurs at the start. So if the app is properly started, it seems you can play as long as you want, it won’t crash. The memory used when crashing is not huge (around 1Gb used by the process and it doesn’t increase/decrease while playing).
First, I made a small Batch to start the app and kill it once every minute to test the app’s stability. Over a night, I end up with around 10-20 crashes (I know it because I got a crash folder with all the logs for each crash).

To be able to test the behaviour of the app a bit more, I changed my Batch to pause it when it detects crash logs in the app’s folder. So I managed to see what’s going on (how much memory used, etc.) when the app is crashed. Weird thing is : I can keep playing if I don’t press the ok button of the window “oops game crashed”.

I also tested the app using the batch that start it every minute on other test platforms. They all have the same hardware configuration. On some of them the same behaviour is observed (at least 10crashes/night), but on others there is no crash at all over 24h test. This makes me think that the crash must be related to some software installed on the PC…

Another test I made is to add log everywhere in my app to see where it crashes and made two observations :

  • The app doesn’t crash at the same point in my code while the resulting stacktrace is always the same,
  • After the app crashed, it keeps logging. So that’s funny, my stacktrace is mixed up with all my debug logs.

I’m adding the outputlog with the debug lines everywhere (so you can see that nice mix between unity’s crash stacktrace & my debug logs) and the cleaned crash log from a build without the debug lines. Btw on those logs you’ll see the app has been built using Unity 4.6.3f1 but I updated Unity hoping this would solve the issue without success (so, same behaviour with my new unity 4.6.6f2.

I think I told you all I know but feel free to ask me more !
Thanks for your time :slight_smile:

EDIT
I ran a DxDiag on two PC, on the first one, the app crashes, on the other one, it doesn’t. I add both files to this post as well.

2159801–142740–output-log.txt (225 KB)
2159801–142741–crashlog.txt (13.4 KB)
2159801–142748–DxDiag_Crash.txt (26.1 KB)
2159801–142749–DxDiag_No_Crash.txt (33.1 KB)

Do you happen to have any crash dumps that you could share?

It looks like a crash in the garbage collector’s thread - that would explain why the main game continues working. However, without a garbage collector, it will not work for long at all.

Does the PC where it crashes have any antivirus software running?

Sure ! Here are all files I got from a crash last week !

2159863–142751–2015-06-12_125120.zip (37.6 KB)

Could you submit these dumps/logs as a bug report? That will get them to the right people to look at. If you could get us the project (which we would treat in a fully confidential way), it may help us figure out even sooner.

I saw a very similar issue, and in the end it turned out to be AV software trying to hook into the game, crashing it in the process. Of course, it might be something totally unrelated.

If you attach Unity’s memory profiler, what is using the majority of memory? Is it managed code or native resources?

I’m gonna submit a bug report right now, would you guys need the whole Unity project or would the built application be enough ? Because the project is really heavy. It takes around 5Gb on my hard drive.

For some reason, Unity’s profiler is not working anymore with our application. I don’t really know why. This might be related to some threading system we use in our app. But I can show you what I see when playing in Editor. The scene is quite heavy as we simulate a rail track of 100km.

Indeed, the managed heap is huge (comparatively speaking, usually games don’t go over 5-10 MB for managed objects).

Unity project would be the best thing you could submit, as the built player wouldn’t be very useful. 5 GB is not really a whole lot, so unless there’s troubles regarding your internet connection, please send the whole project.

Hello again !

I took into account your insight and advices about tier program (eg. AV) hooking into the app. I made some dirty test : I openned the Process Manager and killed a dozen processes that didn’t seem vital for my PC to keep running. Amongst these process, some Microsoft Security tools and a few that I don’t even know. I ran the app in a loop past night and I didn’t crash at all. So I guess you were right, something on that PC seems to crash my app.

By the way I realize i didn’t answer one of your questions : We do not use Anti-Virus software for the moment but only Microsoft Windows Essentials. MWE doesn’t seem to be the origin of the issue though as I already tried disabling its realtime file-check service without any impact on the crash. Anyway, I keep investigating this lead. I tracked the process I killed earlier. So now I’ll kill only half of them and try again to eventually isolate the process that causes the issue. I’ll let you know if I catch it ! :slight_smile:

I also submitted a bug report with the link to this thread, my unity project, built application and the crash logs. I hope you guys will be able to do some kind of try/catch or something because I don’t think my client will like to have to disable its anti virus softwares :smile:

Thank you again for your help !

Something is strange…

As I said in my previous post, I wanted to track which process can be responsible for the crash. So I rebooted the test PC on which the app crashed and restarted my loop starting & killing the game. It did not crash anymore during the last 6hours (I should have observed at least a few crash…). A few days ago, when I rebooted this PC, I observed the same crash pattern after reboot…

Still investigating but I’m definitely lost.

Hi guys,

here is the end (I hope) of the story. We managed to find out what was the source of our crash issue.

  • Some script using unmanaged Windows32 functions was supposed to retrieve the app window size, etc.
  • A second script was supposed to dynamically create and edit a texture that is shown on GUI.
    Somehow, it seems those scripts were responsible of our crashes. A bug report has been submitted with a small repro project and Unity’s guys have been able to reproduce the crash. They’re working on it so it should soon be fixed.

Thanks again for your help and patience !