Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved App crashes after Unity's Loading Screen on Mac - Entities

Discussion in 'Entity Component System' started by kizko, May 30, 2023.

  1. kizko

    kizko

    Joined:
    May 28, 2020
    Posts:
    14
    Hi all.

    I do have a little problem with my build using Unity's DOTS. I am able to generate the build with success but when I try to open it it'll throw the following error:






    Code (CSharp):
    1. Crashed Thread:        0  tid_103  Dispatch queue: com.apple.main-thread
    2.  
    3. Exception Type:        EXC_BREAKPOINT (SIGTRAP)
    4. Exception Codes:       0x0000000000000001, 0x0000000101fbc2fc
    5.  
    6. Termination Reason:    Namespace SIGNAL, Code 5 Trace/BPT trap: 5
    7. Terminating Process:   exc handler [12123]
    8.  
    9. Kernel Triage:
    10. VM - (arg = 0x0) pmap_enter retried due to resource shortage
    11. VM - (arg = 0x0) pmap_enter retried due to resource shortage
    12. VM - (arg = 0x0) pmap_enter retried due to resource shortage
    13.  
    14.  
    15. Thread 0 Crashed:: tid_103 Dispatch queue: com.apple.main-thread
    16. 0   UnityPlayer.dylib                        0x101fbc2fc 0x101b60000 + 4571900
    17. 1   lib_burst_generated.bundle               0x1478421e8 Unity.Entities.EntityQueryImpl.GetSingletonChunk(Unity.Entities.EntityQueryImpl* this, Unity.Entities.TypeIndex typeIndex, ref int outIndexInArchetype, ref Unity.Entities.Chunk* outChunk) -> void_a5af4f8a1a29096ae097b89fbf3e7f6b from Unity.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + 492
    18. 2   lib_burst_generated.bundle               0x147840ab0 DealDamageSystem.OnUpdate(DealDamageSystem* this, ref Unity.Entities.SystemState state) -> void_a5af4f8a1a29096ae097b89fbf3e7f6b from Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + 160
    19. 3   lib_burst_generated.bundle               0x1478e0c5c Unity.Entities.WorldUnmanagedImpl.Unity.Entities.UnmanagedUpdate_000012E9$BurstDirectCall.Invoke(void* pSystemState) -> void_a5af4f8a1a29096ae097b89fbf3e7f6b from Unity.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + 432
    20. 4   ???                                      0x14bc182b0 ???
    21. 5   ???                                      0x14bc17e4c ???
    22. 6   ???                                      0x14bc17d9c ???
    23. 7   ???                                      0x14bc17998 ???
    24. 8   ???                                      0x14bc15f64 ???
    25. 9   ???                                      0x14bc15cc0 ???
    26. 10  ???                                      0x14bc15378 ???
    27. 11  ???                                      0x14bc1524c ???
    28. 12  ???                                      0x122f917c8 ???
    29. 13  libmonobdwgc-2.0.dylib                   0x1203608b8 0x120350000 + 67768
    30. 14  libmonobdwgc-2.0.dylib                   0x1204e74b0 0x120350000 + 1668272
    31. 15  libmonobdwgc-2.0.dylib                   0x1204e73d0 mono_runtime_invoke + 100
    32. 16  UnityPlayer.dylib                        0x1021c6fbc 0x101b60000 + 6713276
    33. 17  UnityPlayer.dylib                        0x1021b6020 0x101b60000 + 6643744
    34. 18  UnityPlayer.dylib                        0x101ff2e44 0x101b60000 + 4795972
    35. 19  UnityPlayer.dylib                        0x101ff2ec4 0x101b60000 + 4796100
    36. 20  UnityPlayer.dylib                        0x101ff3158 0x101b60000 + 4796760
    37. 21  UnityPlayer.dylib                        0x102a0cd34 0x101b60000 + 15387956
    38. 22  Foundation                               0x1acfd1538 __NSFireTimer + 104
    39. 23  CoreFoundation                           0x1ac03c48c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 32
    40. 24  CoreFoundation                           0x1ac03c134 __CFRunLoopDoTimer + 940
    41. 25  CoreFoundation                           0x1ac03bc8c __CFRunLoopDoTimers + 356
    42. 26  CoreFoundation                           0x1ac02141c __CFRunLoopRun + 1852
    43. 27  CoreFoundation                           0x1ac02058c CFRunLoopRunSpecific + 612
    44. 28  HIToolbox                                0x1b5855df4 RunCurrentEventLoopInMode + 292
    45. 29  HIToolbox                                0x1b5855c30 ReceiveNextEventCommon + 648
    46. 30  HIToolbox                                0x1b5855988 _BlockUntilNextEventMatchingListInModeWithFilter + 76
    47. 31  AppKit                                   0x1af23ff58 _DPSNextEvent + 636
    48. 32  AppKit                                   0x1af23f0f4 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 716
    49. 33  AppKit                                   0x1af233558 -[NSApplication run] + 464
    50. 34  AppKit                                   0x1af20a9a8 NSApplicationMain + 880
    51. 35  UnityPlayer.dylib                        0x102a0c804 PlayerMain(int, char const**) + 944
    52. 36  dyld                                     0x1abbebf28 start + 2236
    53.  

    Some context:

    1. One or two builds out of probably 20-25 were not crashing but I couldn't see anything from my subscene rendered.
    2. It is working fine in the editor. After 4-5 mins, Unity crashes. This is what makes me believe it is a memory allocation issue.

    If more information is needed, please let me know and I share them.

    Where should I start with my investigation? How can I find where the memory leaks (if this is the case)? I am new to this and would need some guidance. I don't think I should develop further until I get this fixed. Thank you for your time.
     
  2. kizko

    kizko

    Joined:
    May 28, 2020
    Posts:
    14
    Ok. After few hours of reading and trying to understand... it seems like at frame 2, the app was trying to subtract damage from an entity that didn't even had health/was not Initiated.

    2 lib_burst_generated.bundle 0x147840ab0 DealDamageSystem.OnUpdate(DealDamageSystem* this, ref Unity.Entities.SystemState state) -> void_a5af4f8a1a29096ae097b89fbf3e7f6b from Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + 160

    For other people with the same issue. The first column indicates the frame and what it is called at that frame. Usually, you go through each thread and align it with the logic from your code.


    -> I was just lucky that my entity existed at that point.

    Can someone share with me how can I learn more about the debug process and how can I avoid race-conditions? Thank you