Android Segmentation Fault Issue (Signal 11)

Hey guys,

I’m having a new fun issue and im not really that sure what is the cause of it. Im beginning to think that it is a bug within the unity environment but perhaps it is an error on my part. It’s a segmentation fault on some devies (but not all devices) when I load a seemingly simple level. The code to load the level is trivial

			if(GUI.Button(Rect(2*width/4-width/5,8.5*height/10,2*width/5,height/8.5),"Settings"))
				Application.LoadLevel("settings");

At this point the settings level is loaded. This level quite literally has two objects, the camera and an empty game object called “SettingsBehavior”. The game object holds the following script (Once again a very simple script)

#pragma strict

var width : int;
var height : int;
var selGridInt : int = 0;
var selStrings : String[] = ["Easy", "Medium", "Hard", "Seriously?"];
var skin : GUISkin;

function Start () {
	width = Screen.width;
	height = Screen.height;
	selGridInt = PlayerPrefs.GetInt("difficulty");

}

function OnGUI(){

	GUI.skin = skin;
	GUI.Box(Rect (width/20, height/6, 18*width/20, height/5 + height/5-height/6 + 10), "Difficulty");

    selGridInt = GUI.SelectionGrid (Rect (width/20, height/5, 18*width/20, 1*height/5), selGridInt, selStrings, 2);
    
    if(GUI.Button(Rect(width/4 - width/4, 5*height/6, width/2, height/6), "Save"))
    {
    	PlayerPrefs.SetInt("difficulty",selGridInt);
    	Application.LoadLevel("TitleScreen");
    }
     if(GUI.Button(Rect(width/2, 5*height/6, width/2, height/6), "Cancel"))
         	Application.LoadLevel("TitleScreen");//*/

	
}

Now this runs fine on my device, which is a G2X, but on a Raxr Maxx, and on an LG Marquee it crashes. The debug output of logcat for the marquee crash is as follows

I/Omap3ALSA( 1285): Initialized ALSA PLAYBACK device default
I/DEBUG   ( 1281): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG   ( 1281): Build fingerprint: 'lge/lge_bproj/LG855:2.3.4/GRJ22/ZV4.47a8c0ae:user/release-keys'
I/DEBUG   ( 1281): pid: 7980, tid: 7989  >>> com.test.test <<<
I/DEBUG   ( 1281): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 008336a0
I/DEBUG   ( 1281):  r0 ffffffff  r1 0000004e  r2 00000000  r3 008336a0
I/DEBUG   ( 1281):  r4 00000000  r5 00000004  r6 00001403  r7 0000004e
I/DEBUG   ( 1281):  r8 00519700  r9 497df9d4  10 00000000  fp 00000000
I/DEBUG   ( 1281):  ip 00000001  sp 497df688  lr 8120df64  pc 8120ac54  cpsr 80000010
I/DEBUG   ( 1281):  d0  809082dd90000000  d1  81800006e0002480
I/DEBUG   ( 1281):  d2  0000000000000000  d3  0001060a00000000
I/DEBUG   ( 1281):  d4  0001060a00000000  d5  0000000000030006
I/DEBUG   ( 1281):  d6  0000000000000000  d7  0000000000000000
I/DEBUG   ( 1281):  d8  000000003f800000  d9  0000000040900000
I/DEBUG   ( 1281):  d10 0000000000000000  d11 0000000000000000
I/DEBUG   ( 1281):  d12 0000000000000000  d13 0000000000000000
I/DEBUG   ( 1281):  d14 0000000000000000  d15 0000000000000000
I/DEBUG   ( 1281):  d16 000000003b888889  d17 0000000000000000
I/DEBUG   ( 1281):  d18 3b23d70a00000000  d19 0000000000000000
I/DEBUG   ( 1281):  d20 0000000000000000  d21 00000000bca237c3
I/DEBUG   ( 1281):  d22 bf800000bf800000  d23 3f800000bf7aee42
I/DEBUG   ( 1281):  d24 000000003b888889  d25 0000000000000000
I/DEBUG   ( 1281):  d26 3b23d70a00000000  d27 0000000000000000
I/DEBUG   ( 1281):  d28 0000000000000000  d29 00000000bca237c3
I/DEBUG   ( 1281):  d30 3dccccd0bf755555  d31 3f800000bf7aee42
I/DEBUG   ( 1281):  scr 20000012
I/DEBUG   ( 1281): 
I/DEBUG   ( 1281):          #00  pc 0000ac54  /system/lib/egl/libGLESv2_POWERVR_SGX530_125.so
I/DEBUG   ( 1281):          #01  lr 8120df64  /system/lib/egl/libGLESv2_POWERVR_SGX530_125.so
I/DEBUG   ( 1281): 
I/DEBUG   ( 1281): code around pc:
I/DEBUG   ( 1281): 8120ac34 e28cc001 e1520004 31a02004 e1500004 
I/DEBUG   ( 1281): 8120ac44 21a00004 e15c0001 3afffff7 ea000011 
I/DEBUG   ( 1281): 8120ac54 e19340b4 e1520004 31a02004 e1500004 
I/DEBUG   ( 1281): 8120ac64 21a00004 e15c0001 e1a0408c e28cc001 
I/DEBUG   ( 1281): 8120ac74 3afffff6 ea000007 e793410c e28cc001 
I/DEBUG   ( 1281): 
I/DEBUG   ( 1281): code around lr:
I/DEBUG   ( 1281): 8120df44 e59d3020 e1a00004 e1a01007 e28dc044 
I/DEBUG   ( 1281): 8120df54 e58dc000 e28dc040 e58dc004 ebfff315 
I/DEBUG   ( 1281): 8120df64 e59d8040 e59d9044 e3012401 e5943590 
I/DEBUG   ( 1281): 8120df74 e2888001 e0698008 e1560002 13530000 
I/DEBUG   ( 1281): 8120df84 10888009 11a0900a ea000001 e3a08000 
I/DEBUG   ( 1281): 
I/DEBUG   ( 1281): stack:
I/DEBUG   ( 1281):     497df648  00001100  
I/DEBUG   ( 1281):     497df64c  005672c4  
I/DEBUG   ( 1281):     497df650  002cdf50  
I/DEBUG   ( 1281):     497df654  002dfc40  
I/DEBUG   ( 1281):     497df658  002dfc58  
I/DEBUG   ( 1281):     497df65c  00672898  
I/DEBUG   ( 1281):     497df660  002cdf50  
I/DEBUG   ( 1281):     497df664  002dfc40  
I/DEBUG   ( 1281):     497df668  002dfc58  
I/DEBUG   ( 1281):     497df66c  8120512c  /system/lib/egl/libGLESv2_POWERVR_SGX530_125.so
I/DEBUG   ( 1281):     497df670  002ccd08  
I/DEBUG   ( 1281):     497df674  00000004  
I/DEBUG   ( 1281):     497df678  00001403  
I/DEBUG   ( 1281):     497df67c  0000004e  
I/DEBUG   ( 1281):     497df680  e3a070ad  
I/DEBUG   ( 1281):     497df684  ef9000ad  
I/DEBUG   ( 1281): #00 497df688  002ccd08  
I/DEBUG   ( 1281):     497df68c  8120df64  /system/lib/egl/libGLESv2_POWERVR_SGX530_125.so
I/DEBUG   ( 1281):     497df690  497df6d4  
I/DEBUG   ( 1281):     497df694  497df6d0  
I/DEBUG   ( 1281):     497df698  00000cbc  
I/DEBUG   ( 1281):     497df69c  002b3c04  
I/DEBUG   ( 1281):     497df6a0  3f800000  
I/DEBUG   ( 1281):     497df6a4  3f800000  
I/DEBUG   ( 1281):     497df6a8  00000022  
I/DEBUG   ( 1281):     497df6ac  00519700  
I/DEBUG   ( 1281):     497df6b0  00519700  
I/DEBUG   ( 1281):     497df6b4  8124e4cc  
I/DEBUG   ( 1281):     497df6b8  0000004e  
I/DEBUG   ( 1281):     497df6bc  00000900  
I/DEBUG   ( 1281):     497df6c0  00000022  
I/DEBUG   ( 1281):     497df6c4  491d94cc  
I/DEBUG   ( 1281):     497df6c8  00000014  
I/DEBUG   ( 1281):     497df6cc  00000000  
I/BootReceiver( 1359): Copying /data/tombstones/tombstone_00 to DropBox (SYSTEM_TOMBSTONE)
E/InputDispatcher( 1359): channel '40a7bd58 com.test.test/com.unity3d.player.UnityPlayerNativeActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
E/InputDispatcher( 1359): channel '40a7bd58 com.test.test/com.unity3d.player.UnityPlayerNativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
E/SensorService( 1359): dropping 2 events on the floor (Broken pipe)

I dont think anything Im doing can cause a segmentation fault in a precompiled system binary…

EDIT:
It’s also worth noting that if I remove all of the scenes in the “build settings” except for the settings scene, it loads as expected with no fault

In addition, the culprit is GUI. The scene that is loaded will only crash if there are calls to GUI (i.e GUI.Button)

This is a KNOWN issue. Anyone running into this problem can circumvent it by publishing a development build from the build settings menu.

We have managed to found source of segmentation fault (Signal 11) in our project. It turned out that we had class (normal class, not Monobehaviour) that has [System.Serializable] attribute and one of our programmers implemented default constructor in that class.