Help with SIGBUS error

Everything on my game runs fine in the editor and with unity remote, but when I try to compile my game to xcode to test it on either my iphone or ipad my first level won’t load and I get a SIGBUS error. Here’s what I got from xcode:

→ applicationDidFinishLaunching()
AudioStreamBasicDescription: 2 ch, 44100 Hz, ‘lpcm’ (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved
Could not produce class with ID 154 (Filename: /Users/build/builds/unity-iphone/iphone/Projects/…/Runtime/Serialize/SerializedFile.cpp Line: 685)
Program received signal: “SIGBUS”.
(gdb) continue
Program received signal: “SIGBUS”.
(gdb) continue
Stacktrace:

Debugger stopped.
Program exited with status value:255.

From what I’ve read, SIGBUS errors usually occur when there’s a null reference, but I’ve checked all my scripts and cannot find anything. I’ve also tried deleting the entire xcode build and redoing it several times, but nothing seems to work. My intro screens, directions, and even my second level will load, but the first level just doesn’t seem to be working. So can someone tell me what I can do to fix this or where I can find my error. I’m totally new at this and am not familiar with xcode at all.

I’m not a very technical guy, but from my experience it usually has to do with using up to much device memory. I think your first level is simply a bit too heavy for the iPhone. Try downsizing some textures and stuff and try building again to see what happens.

Hi,
what version of Unity are you running?

I got this in Unity iPhone 1.7

When application stops in GDB, please drop following command to the GDB console:
thread apply all bt

and paste printed stack traces of all threads there. That might give a clue what’s going wrong.

I am getting a similar error, here is the error with the stack traces of all the threads

AudioStreamBasicDescription: 2 ch, 44100 Hz, ‘lpcm’ (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved

End Load File completely 616.255625

Program received signal: “SIGBUS”.
(gdb) thread apply all bt

Thread 8 (thread 13827):
#0 0x31fc28dc in __semwait_signal ()
#1 0x31f77a4c in _pthread_cond_wait ()
#2 0x31f77638 in pthread_cond_wait ()
#3 0x328c43d2 in -[NSCondition wait] ()
#4 0x3289b3ec in -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] ()
#5 0x3289b048 in -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] ()
#6 0x000101e4 in start ()

Thread 7 (thread 13571):
#0 0x31f4a658 in mach_msg_trap ()
#1 0x31f4c72a in mach_msg ()
#2 0x34885724 in AURemoteIO::IOThread::Entry ()
#3 0x347c3c8c in CAPThread::Entry ()
#4 0x31fc398c in _pthread_start ()
#5 0x31fb90ec in thread_start ()

Thread 6 (thread 13315):
#0 0x31f4a6a8 in semaphore_wait_trap ()
#1 0x31f77da4 in semaphore_wait ()
#2 0x00993578 in s_SkinVertices4Bones_Copy4Ints ()
#3 0x009f95f4 in s_SkinVertices4Bones_Copy4Ints ()
Previous frame inner to this frame (gdb could not unwind past this frame)

Thread 5 (thread 13059):
#0 0x31f4a658 in mach_msg_trap ()
#1 0x31f4c72a in mach_msg ()
#2 0x00a31444 in catch_exception_raise ()
#3 0x0095ffac in s_SkinVertices4Bones_Copy4Ints ()
#4 0x31fc398c in _pthread_start ()
Previous frame inner to this frame (gdb could not unwind past this frame)

Thread 4 (thread 12803):
#0 0x31f4a658 in mach_msg_trap ()
#1 0x31f4c72a in mach_msg ()
#2 0x31a762ce in __CFRunLoopServiceMachPort ()
#3 0x31a78588 in __CFRunLoopRun ()
#4 0x31a218ea in CFRunLoopRunSpecific ()
#5 0x31a217f2 in CFRunLoopRunInMode ()
#6 0x3148805c in RunWebThread ()
#7 0x31fc398c in _pthread_start ()
#8 0x31fb90ec in thread_start ()

Thread 3 (thread 12547):
#0 0x31fc485c in __workq_kernreturn ()
#1 0x31fc3e9e in _pthread_wqthread ()
#2 0x31fbcfd4 in start_wqthread ()

Thread 2 (thread 12291):
#0 0x31f76c4c in kevent ()
#1 0x3201fe4c in _dispatch_mgr_invoke ()
#2 0x3201f89c in _dispatch_queue_invoke ()
#3 0x3201fa3c in _dispatch_worker_thread2 ()
#4 0x31fc3d88 in _pthread_wqthread ()
#5 0x31fbcfd4 in start_wqthread ()

Thread 1 (thread 11523):
#0 0x0062564c in start ()

Hello ThinkTank,
your main thread (Thread 1) contains not enough information to tell something. Have you tried to rebuild your app with “Debug” configuration? What stacktrace do you get then?

Thanks for the reply.

I tried building in debug mode but I get: invalid DWARF

which according to this thread:

http://forum.unity3d.com/viewtopic.php?t=49415

is a common problem with unity iphone 1.7 and iOS 4.

Is there anything else that I can do to provide you with sufficient information to help solve me SIGBUS problem?

There is another option - disable native code stripping.

  • Click on Unity iPhone target → Get Info
  • Select Release configuration
  • Search for Other Linker Flags. You should find line with -Wl,-S,-x.
  • Remove all of them
  • Clean all targets
  • Build and run.
  • Get stack traces again.

BTW, there is workaround for DSYM error problem if you have old SDK installed somewhere: http://www.cocoabuilder.com/archive/xcode/290062-generatedsymfile-invalid-dwarf-error.html

I made the necessary changes to get proper call stacks and here they are:

Thread 8 (thread 13827):
#0 0x31fc28dc in __semwait_signal ()
#1 0x31f77a4c in _pthread_cond_wait ()
#2 0x31f77638 in pthread_cond_wait ()
#3 0x328c43d2 in -[NSCondition wait] ()
#4 0x3289b3ec in -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] ()
#5 0x3289b048 in -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] ()
#6 0x0000f304 in -[AppController startRendering:] ()
#7 0x3288ec9c in -[NSThread main] ()
#8 0x329139e0 in NSThread__main ()
#9 0x31fc398c in _pthread_start ()
#10 0x31fb90ec in thread_start ()
Current language: auto; currently c++

Thread 7 (thread 13571):
#0 0x31f4a658 in mach_msg_trap ()
#1 0x31f4c72a in mach_msg ()
#2 0x34885724 in AURemoteIO::IOThread::Entry ()
#3 0x347c3c8c in CAPThread::Entry ()
#4 0x31fc398c in _pthread_start ()
#5 0x31fb90ec in thread_start ()

Thread 6 (thread 13315):
#0 0x31f4a6a8 in semaphore_wait_trap ()
#1 0x31f77da4 in semaphore_wait ()
#2 0x0099f880 in finalizer_thread (unused=<value temporarily unavailable, due to optimizations>) at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/mono/metadata/gc.c:1014
#3 0x00a058fc in start_wrapper (data=<value temporarily unavailable, due to optimizations>) at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/mono/metadata/threads.c:657
#4 0x00a3cccc in thread_start_routine (args=<value temporarily unavailable, due to optimizations>) at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/mono/io-layer/wthreads.c:286
#5 0x0096c2c8 in GC_start_routine (arg=<value temporarily unavailable, due to optimizations>) at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/libgc/pthread_support.c:1390
#6 0x31fc398c in _pthread_start ()
#7 0x31fb90ec in thread_start ()

Thread 5 (thread 13059):
#0 0x31f4a658 in mach_msg_trap ()
#1 0x31f4c72a in mach_msg ()
#2 0x00a3d74c in mach_exception_thread (arg=<value temporarily unavailable, due to optimizations>) at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/mono/mini/mini-darwin.c:248
#3 0x0096c2c8 in GC_start_routine (arg=<value temporarily unavailable, due to optimizations>) at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/libgc/pthread_support.c:1390
#4 0x31fc398c in _pthread_start ()
#5 0x31fb90ec in thread_start ()

Thread 4 (thread 12803):
#0 0x31f4a658 in mach_msg_trap ()
#1 0x31f4c72a in mach_msg ()
#2 0x31a762ce in __CFRunLoopServiceMachPort ()
#3 0x31a78588 in __CFRunLoopRun ()
#4 0x31a218ea in CFRunLoopRunSpecific ()
#5 0x31a217f2 in CFRunLoopRunInMode ()
#6 0x3148805c in RunWebThread ()
#7 0x31fc398c in _pthread_start ()
#8 0x31fb90ec in thread_start ()

Thread 3 (thread 12547):
#0 0x31fc485c in __workq_kernreturn ()
#1 0x31fc3e9e in _pthread_wqthread ()
#2 0x31fbcfd4 in start_wqthread ()

Thread 2 (thread 12291):
#0 0x31f76c4c in kevent ()
#1 0x3201fe4c in _dispatch_mgr_invoke ()
#2 0x3201f89c in _dispatch_queue_invoke ()
#3 0x3201fa3c in _dispatch_worker_thread2 ()
#4 0x31fc3d88 in _pthread_wqthread ()
#5 0x31fbcfd4 in start_wqthread ()

Thread 1 (thread 11523):
#0 0x006267d0 in OptionsMenu_Start ()
#1 0x002e4160 in wrapper_runtime_invoke_object_runtime_invoke_void__this___object_intptr_intptr_intptr ()
#2 0x00a1dd64 in mono_jit_runtime_invoke (method=0x18b63bc, obj=0x5d10cb0, params=0x0, exc=0x2fffdd34) at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/mono/mini/mini.c:4487
#3 0x0088481c in MonoBehaviour::InvokeMethodOrCoroutineChecked ()
#4 0x00884a5c in MonoBehaviour::smile:elayedStartCall ()
#5 0x007d68d8 in DelayedCallManager::Update ()
#6 0x008cbb08 in PlayerLoop ()
#7 0x0094d990 in UnityPlayerLoop ()
#8 0x0000f1f4 in -[AppController Repaint] ()
#9 0x0000f450 in -[AppController startUnity:] ()
#10 0x0068a4dc in -[AppController(OpenFeint) commonInit:] ()
#11 0x00687ccc in -[AppController(OpenFeint) application:didFinishLaunchingWithOptions:] ()
#12 0x32eb73e0 in -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] ()
#13 0x32ff9802 in -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] ()
#14 0x32f06138 in -[UIApplication handleEvent:withNewEvent:] ()
#15 0x32f05a5c in -[UIApplication sendEvent:] ()
#16 0x32f05506 in _UIApplicationHandleEvent ()
#17 0x30672146 in PurpleEventCallback ()
#18 0x31a75aaa in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION ()
#19 0x31a7784e in __CFRunLoopDoSource1 ()
#20 0x31a7862c in __CFRunLoopRun ()
#21 0x31a218ea in CFRunLoopRunSpecific ()
#22 0x31a217f2 in CFRunLoopRunInMode ()
#23 0x32eaf286 in -[UIApplication _run] ()
#24 0x32eade16 in UIApplicationMain ()
#25 0x0000ff38 in main ()

Thread 1 (thread 11523):
#0 0x006267d0 in OptionsMenu_Start ()

Tells me that your problem lies in “OptionsMenu” script “Start()” function. Most likely you are assuming that some stuff is already initialized, but its not yet.

Hi cmasterenko!
I didn’t understand what code you have posted here but i do know the root of this SIGBUS problem.
Its a runtime NULL REFERENCE Exception. XCode generated this error when something in your code gets null reference and then you are using that object to fo something.
For example, if you take a GamObject sphere but didn’t initialize it or you initialize it wrongly say you mistakenly typed a wrong spelling in “Find” or “FindWithTag” method and you are trying to use that GameObject to perform some functionality then your app generates a runtime error and hence SIGBUS.
If you don’t understand this just let me know. I’ll post a script example here.

Anybody here knows how to perform SWIPE gesture.
I’m stuck with it.
Please guys please help me! It has been past 2-3 days since i have been trying to perform this.

You should start a new thread for this question if you haven’t already done so.

Wow, thanks for this tip. You helped me track down a very weird bug with calling GetScreenRect on a GUIText from Start(). I don’t think I would have found it otherwise!

Hello

I seem to be getting a similar “freeze” on ipad splash screen error with Unity 3.2

2011-02-23 14:38:48.575 toppal[2184:307] → registered unity classes

  • Assertion at /Users/mantasp/work/unity/unity-mono/External/Mono/mono/mono/mini/aot-runtime.c:1156, condition `aname’ not met
    Program received signal: “SIGABRT”.
    mi_cmd_stack_list_frames: Not enough frames in stack.
    mi_cmd_stack_list_frames: Not enough frames in stack.
    (gdb) thread apply all bt

Thread 1 (thread 11523):
#0 0x30d7c2d4 in __kill ()
#1 0x30d7c2ca in kill ()
#2 0x30d7c2bc in raise ()
#3 0x30d90d78 in abort ()
#4 0x005f83f8 in s_SkinVertices4Bones_Copy4Ints ()
#5 0x005f8430 in s_SkinVertices4Bones_Copy4Ints ()
#6 0x00000000 in ?? ()
(gdb)

Could you please help me trace this? (btw. I am not sure why the assertion go to /Users/mantasp… I thought I’ll ask here since I noticed the moderator name here is Mantas

hg111