- Home /
how do you interpret error logs?
How can I interpret and fix the error logs? I have a bug somewhere it seems the game always crashes (not in the same spot) the same way, and error logs all say basically the same thing here is an example of two error logs with minutes of difference
Unity Player [version: Unity 4.2.0f4_38efbd14869d]
favoreme.exe caused an Access Violation (0xc0000005)
in module favoreme.exe at 0033:403f335c.
Error occurred at 2013-11-02_195218.
I:\Builds\favoreme.exe, run by rayco.
75% memory in use.
3264 MB physical memory [813 MB free].
10808 MB paging file [3372 MB free].
8388608 MB user address space [8388050 MB free].
Read from location ffffffff caused an access violation.
Context:
RDI: 0x0bbefce0 RSI: 0x00000004 RAX: 0x00000000
RBX: 0x0b4f7570 RCX: 0x00000000 RDX: 0x0000000f
RIP: 0x403f335c RBP: 0x00000030 SegCs: 0x00000033
EFlags: 0x00010202 RSP: 0x001ef410 SegSs: 0x0000002b
R8: 0x00000003 R9: 0x0bbefbf8 R10: 0x00000286
R11: 0x001ef3d0 R12: 0x00000008 R13: 0x00000001
R14: 0x0ba51e28 R15: 0x03d9c428
and the second one
Unity Player [version: Unity 4.2.0f4_38efbd14869d]
favoreme.exe caused an Access Violation (0xc0000005)
in module favoreme.exe at 0033:406a335c.
Error occurred at 2013-11-02_195758.
C:\Users\rayco\Documents\Build\favoreme.exe, run by rayco.
75% memory in use.
3264 MB physical memory [797 MB free].
10808 MB paging file [3315 MB free].
8388608 MB user address space [8387924 MB free].
Read from location ffffffff caused an access violation.
Context:
RDI: 0x27663b80 RSI: 0x00000002 RAX: 0x00000003
RBX: 0x14a87570 RCX: 0x00000009 RDX: 0x0000000c
RIP: 0x406a335c RBP: 0x00000018 SegCs: 0x00000033
EFlags: 0x00010202 RSP: 0x001af2c0 SegSs: 0x0000002b
R8: 0x00000003 R9: 0x27663a40 R10: 0x00000286
R11: 0x001af280 R12: 0x00000008 R13: 0x00000001
R14: 0x2773fa78 R15: 0x03dac428
It happens sometimes when I hit an enemy, specially if there is more than one enemy on screen. How can I interpret this to find the bug?
No, I dont even know what that is, how do you do that? I'm a little worried I want to release a demo in a month and I don't want to give people the impression that my game is full of bugs :S
For your information, its okay to have bugs in your game :)
try/catch is used to allow the program to keep running running if errors occur.
Code is executed in the 'try' block. if an error occurs, an exception is thrown, and the code breaks from the 'try' block, going to the 'catch' block. This 'catch' block contains code that instructs the program what to do if an error occurs. You can have multiple catch blocks for handling specific exceptions.
go through your methods where you think the bug may be occurring, and put:
try{
//your method code here
}
catch(Exception e){
Debug.Log(e.message + ", " + gameObject.name);
//this is for c#. replace e.message with e.get$$anonymous$$essage if using java.
}
If an error occurs in your code, this will display the error type, as well as the gameobject that it originated from, in the console window. Hopefully it'll help you find your issue.
I understand, however what if I don't know where the problem is? because I have no clue really, it seems it happens in one of the level/scenes only and when there´s more than one enemies but other than that I have no clue what could it be.
Answer by Immanuel-Scholz · Nov 07, 2013 at 03:49 PM
In "theory", you should not be able to produce an access violation with just writing C# code. (At least not easily). I doubt that the idea of "exception catching" in the comments would help you here, since the crash probably happens outside the C# environment control.
Without the Unity source code and symbol table, the crash log is not really helpfull either.
Here a general description about how to find any kind of bug systematically. It really works, I do this dozends of times a week:
1 First thing: Backup your scene. 2 Find a way to reliant reproduce the case. Something like "Click here, then move there, than do that, than that and finally quickly that."
Excercise the steps a couple of time so you are sure you can reproduce the case. This will give you a way to ensure, that you actually got rid of the bug later. Also, most of the times you get a very good clue about where the problem could probably be.
Do not skip this step, its the most crucial one in reliable fixing bugs. Just poking around the code and some "mh.. didn't happen for some minutes.. maybe my last change was the fix" is NOT a way of doing things.
3 Next step is to simplify your Scene and Code step-by-step until the error doesn't happen anymore. Always follow the sub-steps:
Backup your scene again (some version control system is excellent here)
Do one of the two following things:
a) Remove lots of stuff where you either think "that's most probably never ever influence the bug". Then verify that the bug is still present. If not, restore to last backup.
b) Remove very few things where you think "that will probably make the problem go away" and check whether the bug is really gone now. If not, restore to last backup.
rinse and repeat
4 After a while, you will have a very good and small test case scene for the crash and in 99% of the cases you know exactly where the problem may be.
5 Now restore to your original scene and fix the bug.
6 Finally test whether its really gone.
7 If its a bug in unity (more often than you might think :( ), file a bug report for unity with your minimal scene attached.
PS: Sorry for the style. The Markup Language used here does not like structured lists..
Hi, thanks for the answer, I've been doing something similar actually, I know its not my coding because it only happens in that particular scene, I think its a corrupted 3D model, sometime ago I bought a pack of 3D models (the same pack im using in this game) and it come with a bunch of textured planes for map tiling, well I had the same error with the same or a pretty similar description and I had to fix the planes by replacing them with Unity's prefab ones and error disappeared; I will do a test with each of the models used in that scene.
will mark your answer as correct as is the right thing to do. Thanks.