Search Unity

Deployed Game Crashes on Startup (Windows 7 and Mac OS X) - Movie Textures?

Discussion in 'Editor & General Support' started by Jagwire, Oct 15, 2015.

  1. Jagwire

    Jagwire

    Joined:
    Dec 5, 2013
    Posts:
    59
    Hello,

    I'm seeing behavior on game startup (after Unity's splash screen) on both Windows 7 and Mac OS X Yosemite, where nearly as soon as the scene starts (a MovieTexture is rigged to play) I get a crash with the following trace. Sometimes I'm able to coax it into not crashing just by restarting and starting again, but most of the time I see the following crash trace:

    Code (csharp):
    1. Receiving unhandled NULL exception
    2. Obtained 18 stack frames.
    3. #0  0x00000100e39a8c in BaseVideoTexture::UpdateVideoTextures()
    4. #1  0x00000100a4e1ec in PlayerLoop(bool, bool, IHookEvent*)
    5. #2  0x000001010632b1 in -[PlayerAppDelegate UpdatePlayer]
    6. #3  0x007fff9328c953 in __NSFireTimer
    7. #4  0x007fff8e5df2e4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
    8. #5  0x007fff8e5def73 in __CFRunLoopDoTimer
    9. #6  0x007fff8e65253d in __CFRunLoopDoTimers
    10. #7  0x007fff8e59a608 in __CFRunLoopRun
    11. #8  0x007fff8e599bd8 in CFRunLoopRunSpecific
    12. #9  0x007fff9a63156f in RunCurrentEventLoopInMode
    13. #10 0x007fff9a6312ea in ReceiveNextEventCommon
    14. #11 0x007fff9a63112b in _BlockUntilNextEventMatchingListInModeWithFilter
    15. #12 0x007fff8ea8d8ab in _DPSNextEvent
    16. #13 0x007fff8ea8ce58 in -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]
    17. #14 0x007fff8ea82af3 in -[NSApplication run]
    18. #15 0x007fff8e9ff244 in NSApplicationMain
    19. #16 0x00000101062ea2 in PlayerMain(int, char const**)
    20. #17 0x000001000020b4 in start
    21.  
    22. Stacktrace:
    23.  
    24. Native stacktrace:
    25.  
    26. 0   libsystem_kernel.dylib              0x00007fff97bec286 __pthread_kill + 10
    27. 1   libsystem_c.dylib                   0x00007fff97e3ab53 abort + 129
    28. 2   build_v4                            0x0000000100abc944 _Z12HandleSignaliP9__siginfoPv + 36
    29. 3   libmono.0.dylib                     0x000000010246a50a mono_chain_signal + 71
    30. 4   libmono.0.dylib                     0x00000001023b7a33 mono_sigsegv_signal_handler + 213
    31. 5   libsystem_platform.dylib            0x00007fff93e26f1a _sigtramp + 26
    32.  
    33. Debug info from gdb:
    34.  
    35. =================================================================
    36. Got a SIGABRT while executing native code. This usually indicates
    37. a fatal error in the mono runtime or one of the native libraries
    38. used by your application.
    39. =================================================================
    40.  
    The trace on Line 3, leads me to believe something is going awry with my MovieTexture. The MovieTexture is packaged with the build. As soon as I remove the code to play the texture, no crashes occur. For what it's worth the following lines are called in a script's Start() method:

    Code (csharp):
    1.  
    2. AudioSource aud = GetComponent<AudioSource>();
    3. MovieTexture movie = image.texture as MovieTexture;
    4. movie.loop = loop;
    5. movie.Play();
    6. aud.clip = movie.audioClip;
    7. aud.Play();
    8.  
    Can someone please point me in the right direction?
     
  2. Jagwire

    Jagwire

    Joined:
    Dec 5, 2013
    Posts:
    59
    FWIW I've come to a work-around, without a whole lot of understanding of exactly what was happening. We narrowed it down to a possible race condition inside Mono/Unity's BaseVideoTexture::UpdateVideoTextures() method. Upon scene unload/new scene load, a SIGSEGV is raised and wrapped by magical Unity things, and made to appear as a SIGABRT.

    My work around was to call Destroy() on the RawImage I was using to access the MovieTexture, and THEN call Application.LoadLevel() as normal. While I'm happy the game is functional again, I would still really like to know exactly what was going on to better understand the problem.

    best regards!
     
  3. jeroen-akershoek

    jeroen-akershoek

    Joined:
    Oct 2, 2015
    Posts:
    1
    This actually hasn't been solved and is still an issue (tested on Unity 5.2.3). The work-around does improve things a bit it seems, but we're still seeing occasional crashes.
     
  4. Jagwire

    Jagwire

    Joined:
    Dec 5, 2013
    Posts:
    59
    @jeroen.akershoek I agree. I still see it in Unity 5.3 I've searched for how to submit an issue to the issue tracker, but I've yet to find a way. I was going to wait and ask around at GDC 2016 to see if anyone knew of the issue.
     
  5. Metastable

    Metastable

    Joined:
    Apr 10, 2013
    Posts:
    50
    Within Unity open the Help drop down from the toolbar and select Report a bug.
     
    Jagwire likes this.
  6. Jagwire

    Jagwire

    Joined:
    Dec 5, 2013
    Posts:
    59
  7. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Just discovered the same issue in 5.30f4

    Do you guys have a case number yet? Please share so I can refer to it.
     
  8. Jagwire

    Jagwire

    Joined:
    Dec 5, 2013
    Posts:
    59
    Yes, the case number I have is: 753985
     
  9. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Thanks.
    What was your workaround exactly? Calling destroy in my preloader wont work since it crashes right at the very start.
     
  10. Jagwire

    Jagwire

    Joined:
    Dec 5, 2013
    Posts:
    59
    What *seems* to work for us is making sure the MovieTexture isn't playing (if it is, call Stop()), and likewise with any audio clip associated with it. Then I destroy the RawImage object I have associated the MovieTexture to, and then I load the next scene with Application.LoadLevel();
     
  11. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    Aha thanks. For me it crashes at startup so I use the platform compile flags to not compile ANY code with movietextures on mac (image fallback)
     
  12. davinciflight

    davinciflight

    Joined:
    Mar 19, 2014
    Posts:
    1
    Just noticed this problem is still around in 5.3.3p1? Did they make any progress on your ticket?
     
  13. Jagwire

    Jagwire

    Joined:
    Dec 5, 2013
    Posts:
    59
    Just checked and there hasn't been any movement. I'm hopong to discuss the bug with someone on staff with Unity at GDC in a few weeks.