Search Unity

5.3.1p1 crash on Andriod when loadlevel or loadlevelAysnc

Discussion in 'Android' started by XiaoJi, Jan 20, 2016.

  1. XiaoJi

    XiaoJi

    Joined:
    Jul 5, 2013
    Posts:
    15
    the trace is there,anyone know why ???

    00 pc 00403b18 /data/app-lib/com.tencent.tmgp.mt2-1bunity.so /Usersilduser/android-ndk_auto-r10e/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/stl_vector.h:612
    #01 pc 004037c8 /data/app-lib/com.tencent.tmgp.mt2-1bunity.so Runtime/Serialize/PersistentManager.cpp: PostLoadStreamNameSpace(nameSpace, nameSpaceID);

    #02 pc 003fec84 /data/app-lib/com.tencent.tmgp.mt2-1bunity.so Runtime/Serialize/PersistentManager.cpp: StreamNameSpace& streamNameSpace = GetStreamNameSpaceInternal (serializedFileIndex);

    #03 pc 003db2d0 /data/app-lib/com.tencent.tmgp.mt2-1bunity.so Runtime/PreloadManager/LoadSceneOperation.cpp: std::string loadErrorMessage = GetPersistentManager().GetLoadErrorMessageFromPath(m_SceneLoadingPath);

    #04 pc 003d9c98 /data/app-lib/com.tencent.tmgp.mt2-1bunity.so Runtime/PreloadManager/PreloadManager.cpp: operation->Perform();

    #05 pc 003d9be8 /data/app-lib/com.tencent.tmgp.mt2-1bunity.so Runtime/PreloadManager/PreloadManager.cpp: manager.Run();

    #06 pc 00433d8c /data/app-lib/com.tencent.tmgp.mt2-1bunity.so Runtime/Threads/Thread.cpp: result = thread->m_EntryPoint(thread->m_UserData);
     
  2. wgt_jimmy

    wgt_jimmy

    Joined:
    Dec 22, 2014
    Posts:
    39
    Does this happen to you every time? We had a similar looking bug in libunity.so that was showing up in our Live builds at a small rate, but it was not reproducible locally. Do you have a small project that reproduces this? I'd be interested in taking a look at it.

    We have submitted a case (759386) to try and get Unity guys to fix.
     
  3. wgt_jimmy

    wgt_jimmy

    Joined:
    Dec 22, 2014
    Posts:
    39
    Also, how did you get the symbols for the callstack? I take it this is from a release version? Because we have the same callstack with addresses that you have plus 0x8 (possibly because ours is in 5.3.1p2)
     
  4. XiaoJi

    XiaoJi

    Joined:
    Jul 5, 2013
    Posts:
    15
    I use the Unity support. and I remove all "Application.LoadLevelAdditive()" code , and the crash is reduce. I still find the reason. next time I never update the Unity...
     
  5. Have you guys tried with 5.3.4p2 or latest?
     
  6. Quantum-Mechanic

    Quantum-Mechanic

    Joined:
    Mar 14, 2013
    Posts:
    7
    Hi Francis,

    dev_jimmy has left our company and I am now responsible for our attempts to move from Unity 4 to Unity 5. We tested with 5.3.4 p5 this weekend and were forced to roll back to Unity 4 due to what we believe are LoadLevelAsync Issues with a call stack like:

    0 java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
    1 Build fingerprint: 'Verizon/VZW_QTAQZ3/QTAQZ3:5.1.1/LMY47V/QZ3_31F46:user/release-keys'
    2 Revision: '0'
    3 pid: 17308, tid: 17415, name: UnityPreload >>> REMOVED <<<
    4 r0 00000000 r1 00000400 r2 000003ff r3 60bbe1f0
    5 r4 4af03ad0 r5 00000400 r6 00000003 r7 00000000
    6 r8 64f92c30 r9 554c7bec sl 53961668 fp 554c7c08
    7 ip 4027464c sp 554c7bd8 lr 52e9795c pc 52e9795c cpsr 512f5637
    8
    9 at libunity.0040995c(Native Method)
    10 at libunity.00409544(Native Method)
    11 at libunity.004049ac(Native Method)
    12 at libunity.003e0dcc(Native Method)
    13 at libunity.003df448(Native Method)
    14 at libunity.003df398(Native Method)
    15 at libunity.0043938c(Native Method)
    16 at libc.__pthread_start(void*)(__pthread_start:30)
    17 at libc.__start_thread(__start_thread:6)

    and

    0 java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000018
    1 Build fingerprint: 'HUAWEI/Y360-U03/HWY360-U:4.4.2/HUAWEIY360-U03/C464B115:user/ota-rel-keys,release-keys'
    2 Revision: '43775'
    3 pid: 30826, tid: 3523, name: UnityPreload >>> REMOVED <<<
    4 r0 00ab984c r1 00000120 r2 00000001 r3 00000dc3
    5 r4 64561bc8 r5 00000b07 r6 00000000 r7 00000000
    6 r8 000003ad r9 640fb2e0 sl 00000002 fp 63a5cc40
    7 ip 00000001 sp 63a5cc30 lr 4006820c pc 62033438 cpsr 36335949
    8
    9 at libunity.00409438(Native Method)
    10 at libunity.004049ac(Native Method)
    11 at libunity.003e0dcc(Native Method)
    12 at libunity.003df448(Native Method)
    13 at libunity.003df398(Native Method)
    14 at libunity.0043938c(Native Method)
    15 at libc.__thread_entry(__thread_entry:72)

    I Would love to know how to Symbolize these call stacks XiaoJi did above? Any tips on how to do it? I will submit a issue as soon as I finish sifting through the crashes.

    Thanks,
    -Phil
     
  7. TagScott

    TagScott

    Joined:
    Oct 17, 2014
    Posts:
    21
    We have been having very similar issues with Unity 5.2.4 on Android. Crashes occur sporadically when loading level and it seems (based on anecdotal evidence) to occur more frequently if we have an OBB split package rather than a single fat APK. The logs we are getting from logcat can differ slightly but the stack is always to do with loading and zip file access of the apk. This one happens to be FMOD but I've also seen UnityPreload. Has anyone on this thread managed to get to the bottom of their issues?

    pid: 14277, tid: 14343, name: FMOD nonblockin >>> com.xxx.xxx <<<
    signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x28
    r0 b6ea77d0 r1 00000001 r2 00000000 r3 ffffff4c
    r4 00000000 r5 008553f0 r6 00000000 r7 b6e9b600
    r8 a4a07df0 r9 008553f0 sl b7a9a3b8 fp b990462c
    ip b6e9bd98 sp a10d82e8 lr a3f0c7d8 pc b6e79634 cpsr 00010030
    #00 pc 00035634 /system/lib/libc.so (fseeko+27)
    #01 pc 004e17d4 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (NativeFile::seek(long, int)+44)
    #02 pc 004ea400 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (ZipFile::ZipFile(ZipCentralDirectory const&, GenericFile*, char const*)+156)
    #03 pc 004c5e98 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (apkOpen+136)
    #04 pc 004d59e0 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (FileSystemAndroidAPK::Open(FileEntryData&, FilePermission, FileAutoBehavior)+52)
    #05 pc 004d74b0 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (LocalFileSystemAndroid::Open(FileEntryData&, FilePermission, FileAutoBehavior)+68)
    #06 pc 00405f10 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (FileAccessor::Open(FileSystemEntry&, FilePermission, FileAutoBehavior)+132)
    #07 pc 0064e3c8 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (FMOD_FILE_Open(char const*, int, unsigned int*, void**, void**)+276)
    #08 pc 00917fd4 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (FMOD::UserFile::reallyOpen(char const*, unsigned int*)+48)
     
    huanzai and Qbit86 like this.
  8. Quantum-Mechanic

    Quantum-Mechanic

    Joined:
    Mar 14, 2013
    Posts:
    7
    Hi TagScott,

    How are you getting better symbols than we are with your crash reports?

    #01 pc 004e17d4 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (NativeFile::seek(long, int)+44)
    #02 pc 004ea400 /data/app/com.xxx.xxx-1/lib/arm/libunity.so (ZipFile::ZipFile(ZipCentralDirectory const&, GenericFile*, char const*)+156)

    Is there a good procedure to symbolize crash reports? Or is just the difference from catching it in Logcat versus catching it in Crittercism?
     
  9. TagScott

    TagScott

    Joined:
    Oct 17, 2014
    Posts:
    21
    If we play connected to Eclipse or Android studio most of the logs are already symbolicated. You can try using the ndk-stack -sym command bundled with the NDK to symbolise files
     
  10. dongbo

    dongbo

    Joined:
    Mar 28, 2015
    Posts:
    3
    did you find the solution about this issue?
     
  11. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    We are experiencing this crash:
    Not sure how to solve it (using Unity 5.3.6)
     
  12. shongbee2

    shongbee2

    Joined:
    Nov 29, 2016
    Posts:
    10
    I
    #00 pc 00d8eb90 libunity.so std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&) [armeabi-v7a]
    2#01 pc 00445a70 libunity.so std::_Rb_tree_iterator<std::pair<int const, SerializedFile::Type> > std::_Rb_tree<int, std::pair<int const, SerializedFile::Type>, std::_Select1st<std::pair<int const, SerializedFile::Type> >, std::less<int>, std::allocator<std::pair<int const, SerializedFile::Type> > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<int const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<int const, SerializedFile::Type> >, std::piecewise_construct_t const&&&, std::tuple<int const&>&&, std::tuple<>&&) [armeabi-v7a]
    3#02 pc 0043d864 libunity.so bool SerializedFile::ReadMetadata<false>(int, unsigned int, unsigned char const*, unsigned int, unsigned int) [armeabi-v7a]
    4#03 pc 0043d44c libunity.so SerializedFile::ReadHeader() [armeabi-v7a]
    5#04 pc 0043be94 libunity.so PersistentManager::GetStreamNameSpaceInternal(int) [armeabi-v7a]
    6#05 pc 00437258 libunity.so PersistentManager::GetLoadErrorMessageFromPath(std::string const&) [armeabi-v7a]
    7#06 pc 00412d70 libunity.so LoadSceneOperation::perform() [armeabi-v7a]
    8#07 pc 00412644 libunity.so PreloadManager::Run() [armeabi-v7a]
    9#08 pc 00412580 libunity.so PreloadManager::Run(void*) [armeabi-v7a]
    10#09 pc 0046dc2c libunity.so Thread::RunThreadWrapper(void*) [armeabi-v7a]
    11#10 pc 000165cf /system/lib/libc.so (__pthread_start(void*)+30) [armeabi-v8]
    12#11 pc 0001467b /system/lib/libc.so (__start_thread+6) [armeabi-v8]

    We are experiencing this crash: not sure how to solve it using int 5.4.3f1
     
  13. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
  14. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    Hi folks.

    Can those of you who are experiencing this crash confirm that you are using the Resources.Load() API, in addition to async scene loading?

    The crash as we understand it is caused by Resources.Load on Android cleaning up some resources used by the async scene load process, so a workaround should be to avoid calling Resources.Load while an async scene load is in-flight. I'm working on changing the code to defer the cleanup so that it doesn't happen until after the async load is done, but if any of you are not using Resources.Load then what we've got here is probably two different bugs.
     
    Flamesharks likes this.
  15. Flamesharks

    Flamesharks

    Joined:
    Dec 18, 2016
    Posts:
    2
    We are experiencing the same problem, and we do use Resources.Load(). It appears that our game randomly crash when change scene. could you tell us how to avoid the crash, or how to reproduce the crash. Please let us know if you fix this bug!
     
  16. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @superpig is there anything more specific? for example - where we use Resources.Load ? or in general, if we use that API in the game, you suspect it leads to this crash ?
     
  17. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    If you call Resources.Load while the async scene load operation is executing (which happens on a background thread) then it can cause the crash. If you're sure that no async scene loads are happening when you call Resources.Load then you should be OK.
     
  18. Flamesharks

    Flamesharks

    Joined:
    Dec 18, 2016
    Posts:
    2
    @superpig, our game online suffering this crash every day, we spend days to find out the reason. I has try use Resources.Load() when our game changing scene(using async scene load method), but the game did not crash. It seems this kind of crash happens in some specific situation. anything more specificl about how to reproduce this crash in develope enviroment?
     
  19. Mimicry

    Mimicry

    Joined:
    Apr 8, 2015
    Posts:
    11
    Is there any further information about this issue? It is really annoying me :(
     
    Qbit86 likes this.
  20. acgleader

    acgleader

    Joined:
    Apr 17, 2013
    Posts:
    40
    and me
     
    Qbit86 likes this.
  21. shongbee2

    shongbee2

    Joined:
    Nov 29, 2016
    Posts:
    10
    We fixed this crash , just avoid to call Resources.load while the async scene load operation is executing.
    check all Resources.load and make sure they are safety
     
    Last edited: Dec 31, 2016
  22. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @shongbee2 it may be a bit difficult to ensure that the Resources.Load call is not used during the scene loading.
    @superpig do you know if converting our Resources calls into local AssetBundle load calls should also fix this ?
     
  23. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,659
    I believe AssetBundle loads would not have the same problem, yeah.
     
  24. shongbee2

    shongbee2

    Joined:
    Nov 29, 2016
    Posts:
    10
    Code (CSharp):
    1. IEnumerator Start()
    2.     {    
    3.         MySceneManager.IsLoading = true;
    4.         AsyncOperation op = UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(sceneName, UnityEngine.SceneManagement.LoadSceneMode.Single);      
    5.         while (op.isDone == false)
    6.         {          
    7.             yield return null;
    8.         }
    9.         MySceneManager.IsLoading = false;
    10.     }
    11.  
    12.     public T MyLoad<T>(string resPath) where T : Object
    13.     {
    14.              
    15.         if(MySceneManager.IsLoading)
    16.         {
    17.             Debug.LogError("the scene is loading, will crash. " + resPath);          
    18.         }
    19.         return Resources.Load<T>(resPath);
    20.     }
    21.  
    22.  
    call MyLoad function can check loading..,
    @liortal
     
  25. Mimicry

    Mimicry

    Joined:
    Apr 8, 2015
    Posts:
    11
    The problem also happens when I invoke WWW.LoadFromCacheOrDownload to load assetbundle from cache. Is it concerned with some automatic Unload Resource processes?
     
    Last edited: Feb 6, 2017
  26. dotsquid

    dotsquid

    Joined:
    Aug 11, 2016
    Posts:
    224
    We have the same problem: SIGSEGV when scene is loaded:
    Code (CSharp):
    1. signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    2.     r0 00000000  r1 00000400  r2 000003ff  r3 cc576410
    3.     r4 00000000  r5 00000015  r6 00000400  r7 00000015
    4.     r8 0000056c  r9 f3b48010  sl d712f6c4  fp 00000a6a
    5.     ip dbc7e0c0  sp d712f680  lr df0884f4  pc df0884f4  cpsr 80070010
    6.     d0  3636663238623038  d1  6330613634363533
    7.     d2  3438373430383237  d3  6564613461386537
    8.     d4  0065353533396436  d5  0000000000000000
    9.     d6  0000000000000000  d7  3566310000000000
    10.     d8  0000000000000000  d9  0000000000000000
    11.     d10 0000000000000000  d11 0000000000000000
    12.     d12 0000000000000000  d13 0000000000000000
    13.     d14 0000000000000000  d15 0000000000000000
    14.     d16 0000000000000000  d17 0000000000000000
    15.     d18 0000001400000056  d19 00000000ffff0100
    16.     d20 0000000000000000  d21 0000000000000000
    17.     d22 00000000ffffffff  d23 6c0789666c078966
    18.     d24 4014000000000000  d25 0000000000000000
    19.     d26 3f80000000000000  d27 4024000000000000
    20.     d28 3ff0000000000000  d29 4014000000000000
    21.     d30 3ff0000000000000  d31 4024000000000000
    22.     scr 2000001b
    23.  
    24. backtrace:
    25.     #00 pc 007264f4  /data/app/com.######.######-1/lib/arm/libunity.so (_ZN17PersistentManager23PostLoadStreamNameSpaceER15StreamNameSpacei+324)
    26.     #01 pc 00725f78  /data/app/com.######.######-1/lib/arm/libunity.so (_ZN17PersistentManager26GetStreamNameSpaceInternalEi+988)
    27.     #02 pc 0072006c  /data/app/com.######.######-1/lib/arm/libunity.so (_ZN17PersistentManager27GetLoadErrorMessageFromPathERKSs+56)
    28.     #03 pc 004f0558  /data/app/com.######.######-1/lib/arm/libunity.so (_ZN18LoadSceneOperation7PerformEv+516)
    29.     #04 pc 004f30a0  /data/app/com.######.######-1/lib/arm/libunity.so (_ZN14PreloadManager22ProcessSingleOperationEv+156)
    30.     #05 pc 004f2d44  /data/app/com.######.######-1/lib/arm/libunity.so (_ZN14PreloadManager3RunEv+36)
    31.     #06 pc 004f2d04  /data/app/com.######.######-1/lib/arm/libunity.so (_ZN14PreloadManager3RunEPv+40)
    32.     #07 pc 00588ab0  /data/app/com.######.######-1/lib/arm/libunity.so (_ZN6Thread16RunThreadWrapperEPv+84)
    33.     #08 pc 0004025b  /system/lib/libc.so (_ZL15__pthread_startPv+30)
    34.     #09 pc 0001a095  /system/lib/libc.so (__start_thread+6)
    The problem is we do not use async loading of the scene, however we do use Resources.Load a lot.
    The crash happens randomly: it could be on the 6th scene being loaded, or the 2nd one.
    It happens on near high-end device with 3GB of RAM, so it's not the culprit.

    UPD. We're using v.5.5.1f1

    Any help? Thanks in advance.
     
    Last edited: Feb 6, 2017
  27. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    @dotsquid we are loading some scenes async, as well as using Resources.Load.

    After the suggestion here, i converted all the Resources.Load<T> calls (that occur while loading a scene) to use other mechanisms. So far, we haven't received any crashes (in QA) after this fix.
     
  28. dotsquid

    dotsquid

    Joined:
    Aug 11, 2016
    Posts:
    224
    @liortal
    Thanks for reply.
    Share your knowledge, master :) What mechanism are you using now instead of Resources.Load<T>?
     
  29. dotsquid

    dotsquid

    Joined:
    Aug 11, 2016
    Posts:
    224
    It seems we found the reason of the crash in our game.
    The crash happened when the AudioClips were loaded. We tried to find out which exactly types of audios caused the problem (load type, compression format, duration, sample rate etc), but we have too much audios to check all the combinations.
    Now I understand that it wasn't a good idea, but before now we've been loading our audios with Resources.Load just after SceneManager.LoadScene. Now we are using SceneManager.sceneLoaded event to load these resources. No single crash yet!
    I hope this information will help Unity team improve the engine, as I believe that, despite it's for sure not a good idea to load resources this way, it's not a reason for engine to crash ;)
     
  30. acgleader

    acgleader

    Joined:
    Apr 17, 2013
    Posts:
    40
    what's your mechanisms? Can you share it?
     
  31. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Yes, i created a wrapper class around Resources (ResourcesEx). This class simply adds logging around calls to Resources.Load calls.

    Then, i loaded up our game, and observed which resources are being loaded during async scene loading operations.
    After that, i convert each of these Resource.Load calls to use other stuff (ScriptableObjects, hook them via the inspector, etc).

    I can dig up the ResourcesEx class i created and attach it here, in case if helps anyone.
     
  32. dotsquid

    dotsquid

    Joined:
    Aug 11, 2016
    Posts:
    224
    Thanks for the reply.
    Fortunately, we've managed to find out the root of the problem.
     
  33. Tx

    Tx

    Joined:
    Jul 4, 2012
    Posts:
    108
    @dotsquid I'm experiencing the same problem. Do you mind telling us who was the culprit in your case?
    Thanks!
     
  34. dotsquid

    dotsquid

    Joined:
    Aug 11, 2016
    Posts:
    224
     
    Tx likes this.
  35. rickypu

    rickypu

    Joined:
    Aug 7, 2013
    Posts:
    9
  36. huanzai

    huanzai

    Joined:
    Feb 11, 2018
    Posts:
    3
    hi TagScott, Did you solve this problem?