Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity 3 EXC_BAD_ACCESS in FMOD::SystemI::createChannelGroupI

Discussion in 'iOS and tvOS' started by aerende, Jul 31, 2010.

  1. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    I'm compiled a project in Unity 3 to the iPhone 4 and after a few menu screens have been selected through on the project on the iPhone 4, when the main game screen loads, I get the following error:


    • Program received signal EXC_BAD_ACCESS, Could not access memory.
      Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
      Program received signal: “EXC_BAD_ACCESS”.
      0x0055f470 in FMOD::SystemI::createChannelGroupInternal ()
      Previous frame inner to this frame (gdb could not unwind past this frame)
      Previous frame inner to this frame (gdb could not unwind past this frame)

    Performing a backtrace in the debugger gives the following path:


    (gdb) bt
    #0 0x0055f470 in FMOD::SystemI::createChannelGroupInternal ()
    #1 0x004feaf8 in FMOD::ChannelI::validate ()
    #2 0x005559b4 in FMOD::SystemI::createChannelGroupInternal ()
    #3 0x00556e78 in FMOD::SystemI::createChannelGroupInternal ()
    #4 0x0054bf14 in FMOD::System::createSound ()
    #5 0x004cbe40 in s_SkinVertices4Bones_Copy4Ints ()
    #6 0x004c0eb4 in s_SkinVertices4Bones_Copy4Ints ()


    Any idea what could be causing this?
     
  2. darshie1976

    darshie1976

    Joined:
    Jun 11, 2008
    Posts:
    929
    Do you have a crash log?

    Looking at the stack trace is easy to figure out what went wrong :)
     
  3. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    Here is what I found in the crash log:


    Thread 0 Crashed:
    0 libSystem.B.dylib 0x000033de pthread_mutex_lock + 50
    1 SecretAgent4G 0x004c0560 0x1000 + 4978016
    2 SecretAgent4G 0x0045a6c0 0x1000 + 4560576
    3 SecretAgent4G 0x004d9480 0x1000 + 5080192
    4 SecretAgent4G 0x00465534 0x1000 + 4605236
    5 SecretAgent4G 0x004b91ac 0x1000 + 4948396
    6 SecretAgent4G 0x0000f80c 0x1000 + 59404
    7 CoreFoundation 0x000277f8 -[NSObject(NSObject) performSelector:withObject:] + 16
    8 Foundation 0x00090bb6 __NSThreadPerformPerform + 262
    9 CoreFoundation 0x00071a86 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
    10 CoreFoundation 0x00073768 __CFRunLoopDoSources0 + 376
    11 CoreFoundation 0x00074504 __CFRunLoopRun + 224
    12 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
    13 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
    14 GraphicsServices 0x000036e8 GSEventRunModal + 108
    15 GraphicsServices 0x00003794 GSEventRun + 56
    16 UIKit 0x000062a0 -[UIApplication _run] + 396
    17 UIKit 0x00004e10 UIApplicationMain + 664
    18 SecretAgent4G 0x00010650 0x1000 + 63056
    19 SecretAgent4G 0x0000f6b4 0x1000 + 59060


    Any clues?
     
  4. darshie1976

    darshie1976

    Joined:
    Jun 11, 2008
    Posts:
    929
    from what i can see, something in your app crashed it; the calls to CF and GS and UIKit are not raising any call that could crash the app.

    Do you know how to symbolicate your app? But from what i see looks like you tried to access to an object that was locked, or tried to lock it and it was already released (debugging code for apps is different from debugging for games in unity, so mine is just a guess :D)
     
  5. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    I created the .dSYM file, but now when the Unity project crashes, Xcode Organizer says there is no log file on the device. And I can't find anything in

    /Library/Logs/CrashReporter/MobileDevice/<DeviceName>

    I've tried resyncing the device on iTunes and restarting XCode.

    Do you know why no log file is created on the device?
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,602
    are you running it with the debugger / xcode?
     
  7. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    Yup, running it with the debugger in XCode.
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,602
    In that case I'm unsure if the logs are generated actually cause the debugger grabs the stuff and outputs it in the gdb console window when you switch to the debug view
     
  9. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    You are probably right. So how do I generate a log file?
     
  10. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,602
    quit the execution in xcode, run it in the application and wait till it crashes.
    the next time you go to the organizer - logs tab, just wait a bit till it has refreshed it and look at it, as it should show up after a few seconds normally when xcode has sync in the new ones.
     
  11. darshie1976

    darshie1976

    Joined:
    Jun 11, 2008
    Posts:
    929
    Would just add that sometimes, if you do not get logs, is possible that you didn't had a crash but the OS killed your app because was leaking memory.

    Check the logs to see if there is any Kill (not the crash logs, the console log)

    I am used to "different" settings, so it never happened to me to not be able to retrieve logs; is just a matter of dealing with the horrible GDB.

    And you do not have to attach the GDB debugger if you get a crash in the device; If GDB gets the output and stops before that the log is written in var, then your best bet is to run the app and wait for the crash; then grab the logs and symbolicate them with the dsym that you created .

    There are a couple of tricks on the ADC site, try to look there and post also there; people are very friendly on that forum too and into xcode debugging (many engineers from apple are on the forum, who better than who write the code can help you? :D)
     
  12. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    @dreamora -

    Thanks. Following your approach I was able to get a logfile. What it looks like is below.

    Xcode symbolicates now automatically, but I don't think the logfile below has been completely symbolicated.


    • Thread 0 Crashed:
      0 SecretAgent4G 0x00fcfb10 start + 16513876
      1 SecretAgent4G 0x0105a7d0 s_SkinVertices4Bones_Copy4Ints + 103432
      2 SecretAgent4G 0x0105a7d0 s_SkinVertices4Bones_Copy4Ints + 103432
      3 SecretAgent4G 0x0105a848 s_SkinVertices4Bones_Copy4Ints + 103552
      4 SecretAgent4G 0x00fdc448 start + 16565388
      5 SecretAgent4G 0x01035e54 start + 16932504
      6 SecretAgent4G 0x00010134 start + 376
      7 CoreFoundation 0x000277f8 -[NSObject(NSObject) performSelector:withObject:] + 16
      8 Foundation 0x00090bb6 __NSThreadPerformPerform + 262
      9 CoreFoundation 0x00071a86 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6
      10 CoreFoundation 0x00073768 __CFRunLoopDoSources0 + 376
      11 CoreFoundation 0x00074504 __CFRunLoopRun + 224
      12 CoreFoundation 0x0001d8e4 CFRunLoopRunSpecific + 224
      13 CoreFoundation 0x0001d7ec CFRunLoopRunInMode + 52
      14 GraphicsServices 0x000036e8 GSEventRunModal + 108
      15 GraphicsServices 0x00003794 GSEventRun + 56
      16 UIKit 0x000062a0 -[UIApplication _run] + 396
      17 UIKit 0x00004e10 UIApplicationMain + 664
      18 SecretAgent4G 0x00010f78 start + 4028
      19 SecretAgent4G 0x0000ffdc start + 32

    I'm using iOS 4.0.1 and I tried to symbolicate the logfile myself and it looks like it was able to symbolicate the SecretAgent binary but not the Apple libraries:

    • Running \/Developer\/usr\/bin\/atos -arch armv6 -o '/Users/jamestesta/Documents/UNITY_IPHONE/SECRET_AGENT_4G/SECRET_AGENT_HD/SecretAgent4GDev/build/SecretAgent4G.app/SecretAgent4G' 0x012edc08 0x0105a44c

      ## Warning: Unable to symbolicate from required binary: /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.0.1/Symbols/System/Library/Frameworks/AudioToolbox.framework/AudioToolbox

    So I was able to symbolicate the SecretAgent binary, but the result didn't give me the line number. Is there another way to determine the line number of the crash?
     
  13. mehware

    mehware

    Joined:
    Nov 19, 2007
    Posts:
    739
    I get the same FMOD::SystemI::createChannelGroupInternal () crash with EXC_BAD_ACCESS with unity3 when I try and run OpenFeint.. grr.
     
  14. darshie1976

    darshie1976

    Joined:
    Jun 11, 2008
    Posts:
    929
    You can only symbolicate what you make (in this case your game); you cannot symbolicate UIKit or Foundation or the other parts of the SDK; anyway looks evident that is the private s_SkinVertices4Bones_Copy4Ints that is crashing the app; probably either is trying to write on an object that does not exist anymore, or is leaking.

    You can notice that the same object is called twice (last 2 lines before the start); or the function is accessing the same memory space, since the pointer is the same (0x0105a7d0)

    You will never get a line where it crash....i wish that the debuggers would be so advanced to tell me what is wrong ;) So is up to you to trace back from that point to find out what causes the crash.

    Guess that the only ones that can help you further are the Unity guys thou; they know their API inside and out
     
  15. groovfruit

    groovfruit

    Joined:
    Apr 26, 2010
    Posts:
    257
    Unity doesn't use the "FMOD" audio engine... does it? Or is the above relating to FMOD as something else? Just curious. Cause the FMOD audio engine is an absolutely buggy piece of crap so I sincerely hope Unity isn't using it for anything.
     
  16. darshie1976

    darshie1976

    Joined:
    Jun 11, 2008
    Posts:
    929
    The issue that he has is not in Fmod; just look at his stack trace
     
  17. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,602
    Unity is using FMOD actually. On desktop since 2.6, on all other platforms since U3

    And FMOD is far from a buggy piece of crap. Thats what Unity went away from (OpenAL)
     
  18. aerende

    aerende

    Joined:
    Apr 27, 2009
    Posts:
    316
    Looks like the latest version of Unity, 3.0.0b5, fixed the problem.
     
unityunity