Search Unity

Bug [BUG] Batchmode + link.xml + Addressables result in an application crash

Discussion in 'Testing & Automation' started by aurelien-morel-ubiant, Sep 3, 2019.

  1. aurelien-morel-ubiant

    aurelien-morel-ubiant

    Joined:
    Sep 27, 2017
    Posts:
    230
    Hello unity guys !
    I'm currently encountered a very annoying issue with our build process in CI.

    I tried to build a project with the Addressables package used to load a distant catalog and asset so there isn't any AddressableAssetsSettings or bundles generated here.

    So our first issue was to have this code part (each element from package) stripped by the UnityLinker.

    After this we tried to add this following link.xml file :

    Code (CSharp):
    1. <linker>
    2.         <assembly fullname="Unity.Addressables" preserve="all"/>
    3.         <assembly fullname="Unity.ResourceManager" preserve="all"/>
    4. </linker>
    Then we rebuilt our project in a normal Unity Editor workflow (on a dev computer with graphics etc...) and it fixed our stripping issue. With IL2CPP or with Mono2x.

    So after this we pushed our modification on our gitlab server and start a CI pipeline build to generate a clean version on server.

    BUT

    After this specific modification and this command line (it's a windows example but we have the same on our Mac build machine with a shell syntax) :

    And this command worked but the application crashed on our Android device with this dump extract :

    Code (CSharp):
    1. 09-03 10:36:53.749: E/CRASH(10310): signal 6 (SIGABRT), code -6 (?), fault addr --------
    2. 09-03 10:36:53.749: E/CRASH(10310): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    3. 09-03 10:36:53.749: E/CRASH(10310): Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
    4. 09-03 10:36:53.749: E/CRASH(10310): Build fingerprint: 'OnePlus/OnePlus5/OnePlus5:9/PKQ1.180716.001/1907311824:user/release-keys'
    5. 09-03 10:36:53.749: E/CRASH(10310): Revision: '0'
    6. 09-03 10:36:53.749: E/CRASH(10310): pid: 10310, tid: 10448, name: UnityPreload  >>> com.ubiant.myhemisdev <<<
    7. 09-03 10:36:53.749: E/CRASH(10310):     x0   0000000000000000  x1   00000000000028d0  x2   0000000000000006  x3   0000000000000008
    8. 09-03 10:36:53.749: E/CRASH(10310):     x4   0000000000000000  x5   0000000000000000  x6   0000000000000000  x7   0000000000000000
    9. 09-03 10:36:53.749: E/CRASH(10310):     x8   0000000000000083  x9   1263e24c55bc87e9  x10  0000000000000000  x11  fffffffc7ffffbdf
    10. 09-03 10:36:53.749: E/CRASH(10310):     x12  0000000000000001  x13  ffffffffffffffff  x14  0000000000000000  x15  ffffffffffffffff
    11. 09-03 10:36:53.749: E/CRASH(10310):     x16  00000070f146b2a8  x17  00000070f138a954  x18  0000000012fd4c94  x19  0000000000002846
    12. 09-03 10:36:53.749: E/CRASH(10310):     x20  00000000000028d0  x21  0000007050dab000  x22  0000007043742fe0  x23  0000007048900bf0
    13. 09-03 10:36:53.749: E/CRASH(10310):     x24  0000007048900cd8  x25  0000007055506c40  x26  0000000000000001  x27  0000000000800101
    14. 09-03 10:36:53.749: E/CRASH(10310):     x28  0000000000000000  x29  0000007048900800  x30  00000070f137e084
    15. 09-03 10:36:53.749: E/CRASH(10310):     sp   00000070489007c0  pc   00000070f137e0ac  pstate 0000000060000000
    16. 09-03 10:36:53.749: E/CRASH(10310): backtrace:
    17. 09-03 10:36:53.786: E/CRASH(10310):     #00  pc 000000000000068c  [vdso] ()
    18. 09-03 10:36:53.786: E/CRASH(10310):     #01  pc 00000000000220a8  /system/lib64/libc.so (abort+112)
    19. 09-03 10:36:53.786: E/CRASH(10310):     #02  pc 0000000000c71264  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libil2cpp.so (_ZN9__gnu_cxx27__verbose_terminate_handlerEv+396)
    20. 09-03 10:36:53.786: E/CRASH(10310):     #03  pc 0000000000c6aa4c  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libil2cpp.so (_ZN10__cxxabiv111__terminateEPFvvE+8)
    21. 09-03 10:36:53.786: E/CRASH(10310):     #04  pc 0000000000c6aab8  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libil2cpp.so (_ZSt9terminatev+12)
    22. 09-03 10:36:53.787: E/CRASH(10310):     #05  pc 0000000000c6abf4  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libil2cpp.so (__cxa_throw+136)
    23. 09-03 10:36:53.787: E/CRASH(10310):     #06  pc 0000000000c2f71c  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libil2cpp.so ()
    24. 09-03 10:36:53.787: E/CRASH(10310):     #07  pc 0000000000c45828  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libil2cpp.so ()
    25. 09-03 10:36:53.787: E/CRASH(10310):     #08  pc 000000000063cbf0  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN15SerializeTraitsI31ArrayOfManagedObjectsTransfererE19ResizeSTLStyleArrayERS0_i+56)
    26. 09-03 10:36:53.787: E/CRASH(10310):     #09  pc 000000000063cb20  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN18StreamedBinaryRead21TransferSTLStyleArrayI31ArrayOfManagedObjectsTransfererEEvRT_17TransferMetaFlags+80)
    27. 09-03 10:36:53.787: E/CRASH(10310):     #10  pc 0000000000634c18  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so ()
    28. 09-03 10:36:53.787: E/CRASH(10310):     #11  pc 00000000006349dc  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_Z30TransferField_LinearCollectionI18StreamedBinaryReadEvRK29SerializationCommandArgumentsR31RuntimeSerializationCommandInfo+112)
    29. 09-03 10:36:53.787: E/CRASH(10310):     #12  pc 0000000000631ce4  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_Z28ExecuteSerializationCommandsI18StreamedBinaryReadEvRK13dynamic_arrayI20SerializationCommandLm0EERT_RK17GeneralMonoObject+120)
    30. 09-03 10:36:53.787: E/CRASH(10310):     #13  pc 0000000000631c4c  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_Z23TransferScriptingObjectI18StreamedBinaryReadEvRT_18ScriptingObjectPtr17ScriptingClassPtrPK15MonoScriptCache+240)
    31. 09-03 10:36:53.787: E/CRASH(10310):     #14  pc 000000000065792c  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN33ManagedObjectHostTransferRedirectI13MonoBehaviourE8TransferERS0_R18StreamedBinaryRead+72)
    32. 09-03 10:36:53.787: E/CRASH(10310):     #15  pc 0000000000621ff4  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN14SerializedFile10ReadObjectEl18ObjectCreationModebPPK8TypeTreePbR6Object+656)
    33. 09-03 10:36:53.787: E/CRASH(10310):     #16  pc 000000000062305c  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN17PersistentManager29ReadAndActivateObjectThreadedEiRK26SerializedObjectIdentifierP14SerializedFilebbNS_9LockFlagsE+276)
    34. 09-03 10:36:53.787: E/CRASH(10310):     #17  pc 0000000000623734  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN17PersistentManager26LoadFileCompletelyThreadedERKN4core12basic_stringIcNS0_20StringStorageDefaultIcEEEEPlPiiNS_9LoadFlagsER12LoadProgressNS_9LockFlagsE+712)
    35. 09-03 10:36:53.787: E/CRASH(10310):     #18  pc 00000000007e9d38  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN18LoadSceneOperation7PerformEv+1320)
    36. 09-03 10:36:53.787: E/CRASH(10310):     #19  pc 00000000007ebe94  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN14PreloadManager22ProcessSingleOperationEv+108)
    37. 09-03 10:36:53.787: E/CRASH(10310):     #20  pc 00000000007ebc04  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN14PreloadManager3RunEv+160)
    38. 09-03 10:36:53.787: E/CRASH(10310):     #21  pc 00000000007eba60  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN14PreloadManager3RunEPv+44)
    39. 09-03 10:36:53.787: E/CRASH(10310):     #22  pc 000000000075ed84  /data/app/com.ubiant.myhemisdev-j2U9ej7FzrwG8IlpOMWjyQ==/lib/arm64/libunity.so (_ZN6Thread16RunThreadWrapperEPv+668)
    40. 09-03 10:36:53.787: E/CRASH(10310):     #23  pc 000000000008ffc8  /system/lib64/libc.so (_ZL15__pthread_startPv+36)
    41. 09-03 10:36:53.787: E/CRASH(10310):     #24  pc 0000000000023968  /system/lib64/libc.so (__start_thread+68)
    42. 09-03 10:36:54.887: E/ndroid.systemu(2428): Invalid ID 0x00000000.

    So we tried to remove arguments (unity's one not ours) to find where was the issue.

    So here is the result of our investigation :

    First command (the one above) generates all what I wrote right above.

    Second command which is the same without -nographics generates the same build (obviously but we tried just to be sure)

    Thrid command which is the same without -batchmode -nographics generates a build that is finally ok. So it seems to be something related to the "-batchmode" argument and "link.xml" instruction or Addressables or both.

    @superpig and @unity_bill if you have any clue concerning that kind of bug on a building part or on the Addressables part feel free to share them with me ^^

    I continue my investigation, I can probably almost generate a bug tracking issue if you need cause for me it seems to be a bug in relation with Addressables and this batchmode + link.xml.

    I did a StandaloneWindows64 build (mono not il2cpp like our Android build above) the issue still happens and I have a maybe ""clearer"" crash log + dump. I linked it in the forum post as extra piece.
    But globally the issue is this one :

    Code (CSharp):
    1. biant PC Dev by Ubiant [version: Unity 2018.4.6f1_cde1bbcc9f0d]
    2.  
    3. mono-2.0-bdwgc.dll caused an Access Violation (0xc0000005)
    4.   in module mono-2.0-bdwgc.dll at 0033:af038150.
    5.  
    6. Error occurred at 2019-09-03_134648.
    7. D:\Project\MyHemisForFlexom\Build\Windows\Flexom 2.0.exe, run by Aurélien.
    8.  
    9. 49% physical memory in use.
    10. 16276 MB physical memory [8155 MB free].
    11. 192 MB process peak paging file [189 MB used].
    12. 138 MB process peak working set [134 MB used].
    13. System Commit Total/Limit/Peak: 16438MB/23554MB/32208MB
    14. System Physical Total/Available: 16276MB/8155MB
    15. System Process Count: 236
    16. System Thread Count: 3277
    17. System Handle Count: 113545
    18. Disk space data for 'C:\Users\AURLIE~1\AppData\Local\Temp\Ubiant\Ubiant PC Dev\Crashes\Crash_2019-09-03_114646537\': 117055004672 bytes free of 254050037760 total.
    19.  
    20. Read from location 0000000000000000 caused an access violation.
    21.  
    22. Context:
    23. RDI:    0x000000a4003ff130  RSI: 0x000000a4003ff540  RAX:   0x0000000000000000
    24. RBX:    0x000000a4003ff080  RCX: 0x0000000000000000  RDX:   0x0000000000000000
    25. RIP:    0x00007ffaaf038150  RBP: 0x000000a4003ff180  SegCs: 0x0000000000000033
    26. EFlags: 0x0000000000010202  RSP: 0x000000a4003ff018  SegSs: 0x000000000000002b
    27. R8:     0x000001a4eeca15c0  R9:  0x0000000000008000  R10:   0x0000cba5ceb058a3
    28. R11:    0x000000a4003ff040  R12: 0x0000000000000000  R13:   0x000001a4fe6c6578
    29. R14:    0x00000000c1160000  R15: 0x000000a4ffffffff
    30.  
    31.  
    32. Bytes at CS:EIP:
    33. 48 8b 01 48 8b 00 c3 cc cc cc cc cc cc cc cc cc
    34.  
    35. Mono DLL loaded successfully at 'D:\Project\MyHemisForFlexom\Build\Windows\MonoBleedingEdge\EmbedRuntime\mono-2.0-bdwgc.dll'.
    36.  
    37.  
    38. Stack Trace of Crashed Thread 7160:
    39. 0x00007FFAAF038150 (mono-2.0-bdwgc) mono_object_get_class
    40. 0x00007FFA8A899A22 (UnityPlayer) UnityMain
    41. ERROR: SymGetSymFromAddr64, GetLastError: 'Tentative d’accès à une adresse non valide.' (Address: 00007FFA89BB3CA6)
    42. 0x00007FFA89BB3CA6 (UnityPlayer) (function-name not available)
    43. 0x00007FFA8A8AA717 (UnityPlayer) UnityMain
    44. 0x00007FFA8A8B7209 (UnityPlayer) UnityMain
    45. 0x00007FFA8A8A63D3 (UnityPlayer) UnityMain
    46. 0x00007FFA8A8AB98D (UnityPlayer) UnityMain
    47. 0x00007FFA8A8B8FAE (UnityPlayer) UnityMain
    48. 0x00007FFA8A885E79 (UnityPlayer) UnityMain
    49. 0x00007FFA8A8CC7E2 (UnityPlayer) UnityMain
    50. 0x00007FFA8A8CBF15 (UnityPlayer) UnityMain
    51. 0x00007FFA8A8C95BB (UnityPlayer) UnityMain
    52. 0x00007FFA8A6091EA (UnityPlayer) UnityMain
    53. 0x00007FFA8A609DE3 (UnityPlayer) UnityMain
    54. 0x00007FFA8A60A1DD (UnityPlayer) UnityMain
    55. 0x00007FFA8A6C4F5F (UnityPlayer) UnityMain
    56. 0x00007FFB02487974 (KERNEL32) BaseThreadInitThunk
    57. 0x00007FFB0377A271 (ntdll) RtlUserThreadStart
     

    Attached Files:

    Last edited: Sep 3, 2019
  2. aurelien-morel-ubiant

    aurelien-morel-ubiant

    Joined:
    Sep 27, 2017
    Posts:
    230
    Edit : I tried in a last attempt by updating to 2018.4.8f1 and the bug is gone :eek:

    Could it be related to :
    Kernel: Fixed player crash due to stack overflow in Loading.PreloadManager thread. (1162496, 1176882)

    Cause the crash number is not interactable and I always like to know what was the problem when it's just fixed by updating unity :)