Search Unity

Crashes on iOS (UI::UIGeometryJob)

Discussion in 'iOS and tvOS' started by liortal, Nov 7, 2015.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    We are experiencing crashes in our game on iOS.
    These seem to be UI related (from the crash stack trace):
    Code (CSharp):
    1.     mygame    UI::UIGeometryJob(UI::UIGeometryJobData*) (in mygame) (UIJobs.cpp:289)
    2. 1    mygame    JobQueue::Exec(JobInfo*, int, int) (in mygame) (JobQueue.cpp:271)
    3. 2    mygame    JobQueue::Steal(JobGroup*, JobInfo*, int, int) (in mygame) (JobQueue.cpp:395)
    4. 3    mygame    JobQueue::ExecuteJobFromQueue() (in mygame) (JobQueue.cpp:557)
    5. 4    mygame    JobQueue::ProcessJobs(void*, bool*) (in mygame) (JobQueue.cpp:634)
    6. 5    mygame    JobQueue::WorkLoop(void*) (in mygame) (JobQueue.cpp:651)
    7. 6    mygame    Thread::RunThreadWrapper(void*) (in mygame) (Thread.cpp:40)
    8. 7    libsystem_pthread.dylib    0x355eec7f 0x355ec000 + 11391
    9. 8    libsystem_pthread.dylib    0x355eebf3 0x355ec000 + 11251
    10. 9    libsystem_pthread.dylib    0x355eca08 0x355ec000 + 2568
    Does this look familiar (like an issue that was already resolved in one of the latest versions) ?
    Also, @phil-Unity does this ring a bell as something you're aware of ?
     
  2. Heino

    Heino

    Joined:
    Jan 3, 2013
    Posts:
    6
    We suddenly started seeing this error too. Has anyone been able to track it down what the issue is? We haven't added anything really new and different lately, so I don't understand why this issue would suddenly start showing. We're using Vuforia, but not sure if that has anything to do with it.

    As liortal reports, it seems to be Unity UI related, since the crash happens in the UI::UIGeometryJob. Any help or ideas for workaround would be much appreciated.
     
    liortal likes this.
  3. Heino

    Heino

    Joined:
    Jan 3, 2013
    Posts:
    6
    We've managed to track this down to being related to UI somehow, but we have not managed to find out exactly why it happens. We added some GUI last week, which takes the position of a game world object, converts it to screen space coordinates and then positions a GUI element on that screen position. We're setting the local position of a transform that is the GUI object, so our suspicion is that maybe this object gets set to a position far outside the normal range and that's then what's causing the crash. We just can't see how this value should end up suddenly being out of range.

    In any case, the error is quite unspecific and, at least in our case, it's hard to pinpoint an exact moment when the crash happens, which makes it difficult to determine exactly what causes the crash.
     
  4. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    At the moment we haven't received bugreport for such issues.
    Could you please submit report with some repro project attached to it?
    Thanks!
     
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Hi @Mantas Puida

    Unfortunately we cannot submit our game project for every bug report. Some simpler issues are reproduced easily with a stripped down project, but this issue occurs randomly and i have no exact repro...

    Should we report this without a project? Is there anything that can be done on your side with a project ?
     
  6. Dkarigi

    Dkarigi

    Joined:
    Sep 21, 2015
    Posts:
    2
    This issue is happening for us too @Mantas Puida and causing more than 5 crashes per hour
     
  7. Dkarigi

    Dkarigi

    Joined:
    Sep 21, 2015
    Posts:
    2
    JobQueue.cpp line 363
    JobQueue::Steal(JobGroup*, JobInfo*, int, int)
    4

    JobQueue.cpp line 557
    JobQueue::ExecuteJobFromQueue()
    5

    JobQueue.cpp line 634
    JobQueue::processJobs(void*, bool*)
    6

    JobQueue.cpp line 668
    JobQueue::WorkLoop(void*)
     
  8. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Do you have bugreport for it?
     
  9. issfire

    issfire

    Joined:
    Jan 27, 2013
    Posts:
    7
    We have submitted a bug report. It's happening quite frequently on iOS 9.X on Unity 5.2.3p3
    Unfortunately, our project is too large to upload
     
  10. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Any update on this ? I'm still seeing this a couple of times per day. Our game is still in beta and not used by a lot of players, but we'd like to find a solution for this issue... Any leads on this yet?
     
  11. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Which Unity version are you using? Does it still happen with Unity 5.3.x?
     
  12. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I am on 5.2.1, i will try to upgrade to the latest one available (5.3.1p4 and see if that still occurs).

    While we're at it - do you know what happened to my PR for the XcodeAPI project? i didnt see it end up in any released version... :(
     
  13. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    Still happens (on 5.2.4) here is another one i saw today (has a few other method calls on top of the stack):

    Code (CSharp):
    1. 0    libsystem_kernel.dylib    __pthread_kill (in libsystem_kernel.dylib) + 8
    2. 1    libsystem_c.dylib    abort (in libsystem_c.dylib) + 140
    3. 2    libsystem_malloc.dylib    szone_size (in libsystem_malloc.dylib) + 0
    4. 3    gamebuild    std::__1::__vector_base<SubMesh, stl_allocator<SubMesh, (MemLabelIdentifier)10, 16> >::~__vector_base() (in gamebuild) (vector:474)
    5. 4    gamebuild    SharedMeshData::~SharedMeshData() (in gamebuild) (SharedMeshData.h:10)
    6. 5    gamebuild    ThreadSharedObject::Release(MemLabelId) const (in gamebuild) (ThreadSharedObject.h:16)
    7. 6    gamebuild    UI::UIGeometryJob(UI::UIGeometryJobData*) (in gamebuild) (UIJobs.cpp:301)
    8. 7    gamebuild    JobQueue::Exec(JobInfo*, long long, int) (in gamebuild) (JobQueue.cpp:291)
    9. 8    gamebuild    JobQueue::Steal(JobGroup*, JobInfo*, long long, int) (in gamebuild) (JobQueue.cpp:395)
    10. 9    gamebuild    JobQueue::ExecuteJobFromQueue() (in gamebuild) (JobQueue.cpp:557)
    11. 10    gamebuild    JobQueue::ProcessJobs(void*, bool*) (in gamebuild) (JobQueue.cpp:634)
    12. 11    gamebuild    JobQueue::WorkLoop(void*) (in gamebuild) (JobQueue.cpp:688)
    13. 12    gamebuild    Thread::RunThreadWrapper(void*) (in gamebuild) (Thread.cpp:40)
    14. 13    libsystem_pthread.dylib    _pthread_body (in libsystem_pthread.dylib) + 156
    15. 14    libsystem_pthread.dylib    _pthread_body (in libsystem_pthread.dylib) + 0
    16. 15    libsystem_pthread.dylib    thread_start (in libsystem_pthread.dylib) + 4
     
  14. mhalttu

    mhalttu

    Joined:
    Mar 13, 2013
    Posts:
    30
    @Mantas Puida This issue still happens on Unity 5.3.2. It is by far the most common crash we have. Sending you our project would not help because this is very difficult to reproduce. What you guys should do is just stress test showing a hierarchy of standard UI elements on iOS devices.

    However, here are some things that might help you guys to analyze it:
    • It seems to happen very near the startup when we show a tutorial speech bubble for the first time.
    • Do note that for 99.x% of the cases the crash does not occur.
    • The speech bubble contains standard elements like Image, Button, Animator, HorizontalLayoutGroup, etc.
    • The crash mostly happens once per user, which indicates that it is very random and not user-specific
    • The crash is not limited to a certain iDevice model or iOS version
    • The crash occurs in a worker thread:
    Code (CSharp):
    1. Thread : Crashed: Worker Thread
    2. 0  roperunner                     0xd0bf4a UI::UIGeometryJob(UI::UIGeometryJobData*) (Matrix4x4.h:304)
    3. 1  roperunner                     0xd0b4f5 UI::UIGeometryJob(UI::UIGeometryJobData*) (UIJobs.cpp:182)
    4. 2  roperunner                     0xa89607 JobQueue::Exec(JobInfo*, int, int) (JobQueue.cpp:325)
    5. 3  roperunner                     0xa895b7 JobQueue::Steal(JobGroup*, JobInfo*, int, int) (JobQueue.cpp:444)
    6. 4  roperunner                     0xa897a1 JobQueue::ExecuteJobFromQueue() (JobQueue.cpp:641)
    7. 5  roperunner                     0xa89875 JobQueue::ProcessJobs(void*, bool*) (JobQueue.cpp:720)
    8. 6  roperunner                     0xa891e1 JobQueue::WorkLoop(void*) (JobQueue.cpp:739)
    9. 7  roperunner                     0xba6c6f Thread::RunThreadWrapper(void*) (Thread.cpp:40)
    10. 8  libsystem_pthread.dylib        0x38bd7919 _pthread_body + 140
    11. 9  libsystem_pthread.dylib        0x38bd788b _pthread_start + 102
    12. 10 libsystem_pthread.dylib        0x38bd5aa4 thread_start + 8
    • The main thread does not crash. The status is as follows:
    Code (CSharp):
    1. Thread : com.apple.main-thread
    2. 0  roperunner                     0xb7dc00 AtomicList::Relax() (AtomicQueue.cpp:1558)
    3. 1  roperunner                     0xa60c09 JobQueue::WaitForJobGroup(JobGroupID, bool) (JobQueue.cpp:1218)
    4. 2  roperunner                     0xa5fa73 CompleteFenceInternal(JobFence&) (Jobs.cpp:26)
    5. 3  roperunner                     0xab1a31 GeometryJobTasks::PutGeometryJobFence(GfxDevice&, unsigned int) (GeometryJob.cpp:37)
    6. 4  roperunner                     0xcde5c5 UI::Canvas::UpdateBatches(bool) (Canvas.cpp:1072)
    7. 5  roperunner                     0xce0b19 UI::CanvasManager::WillRenderCanvases() (vector:1484)
    8. 6  roperunner                     0xb02e3b PlayerLoop(bool, bool, IHookEvent*) (Player.cpp:1787)
    9. 7  roperunner                     0xd1070b UnityPlayerLoopImpl(bool) (LibEntryPoint.mm:239)
    10. 8  roperunner                     0x53225 UnityRepaint (DisplayManager.h:71)
    11. 9  roperunner                     0x53025 -[UnityAppController(Rendering) repaintDisplayLink] (UnityAppController+Rendering.mm:52)
    12. 10 QuartzCore                     0x2865bb67 CA::Display::DisplayLinkItem::dispatch() + 98
    13. 11 QuartzCore                     0x2865b9cf CA::Display::DisplayLink::dispatch_items(unsigned long long, unsigned long long, unsigned long long) + 366
    14. 12 IOMobileFramebuffer            0x2d40ac03 IOMobileFramebufferVsyncNotifyFunc + 90
    15. 13 IOKit                          0x26513d0d IODispatchCalloutFromCFMessage + 256
    16. 14 CoreFoundation                 0x2554e335 __CFMachPortPerform + 132
    17. 15 CoreFoundation                 0x2555e82b __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 34
    18. 16 CoreFoundation                 0x2555e7c7 __CFRunLoopDoSource1 + 346
    19. 17 CoreFoundation                 0x2555cde9 __CFRunLoopRun + 1608
    20. 18 CoreFoundation                 0x254a86d1 CFRunLoopRunSpecific + 476
    21. 19 CoreFoundation                 0x254a84e3 CFRunLoopRunInMode + 106
    22. 20 GraphicsServices               0x2ce531a9 GSEventRunModal + 136
    23. 21 UIKit                          0x28c5a445 UIApplicationMain + 1440
    24. 22 roperunner                     0x4bcfb main (main.mm:32)
    25. 23 libdyld.dylib                  0x343e2aaf start + 2
     
    MrEsquire likes this.
  15. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Could you extract your speech bubble to unity package and submit as bugreport?
    Thanks!
     
  16. NoseKills

    NoseKills

    Joined:
    Jun 4, 2013
    Posts:
    25
    Having the same issue in 5.3.4f1. We have a UI item prefab with Image + LayoutElement script and 2 Text children.
    This prefab is the 6th child in the hierarchy, the root object being an object with Screen Space - Camera canvas, "Scale with screen size" canvas scaler and a graphics raycaster.

    When the prefab is pressed on, we instantiate a new instance of it to be shown as a dragged copy of the item, disable the LayoutElement component on the clone, parent it to the same parent as the original, and set a new size for the clone.

    Code (CSharp):
    1.  
    2. if (isDraggingCopy) {
    3.             layoutElement.ignoreLayout = true;
    4.             rectTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 100);
    5.             rectTrans.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 100);
    6.             return;
    7. }
    With IDragHandler methods we move the instantiated GameObject lie this

    Code (CSharp):
    1.  
    2.     private void OnDrag(PointerEventData data) {
    3.                     Vector3 globalMousePos;
    4.             if (RectTransformUtility.ScreenPointToWorldPointInRectangle(rectTrans, data.position, data.pressEventCamera, out globalMousePos)) {
    5.                 draggingCopy.transform.position = globalMousePos;
    6.             }
    7.         }
    8.     }

    On iOS device the build always eventually crashes if you just press on the prefab and drag the "draggingCopy" around enough. Debug.Log on the last line of OnDrag is the last thing to print out before the crash.

    • ;UI::UIGeometryJob(UI::UIGeometryJobData*);Matrix4x4.h;304
    • ;JobQueue::Exec(JobInfo*, long long, int);JobQueue.cpp;325
    • ;JobQueue::Steal(JobGroup*, JobInfo*, long long, int);JobQueue.cpp;444
    • ;JobQueue::ExecuteJobFromQueue();JobQueue.cpp;641
    • ;JobQueue::processJobs(void*, bool*);JobQueue.cpp;720
    • ;JobQueue::WorkLoop(void*);JobQueue.cpp;754
    • ;Thread::RunThreadWrapper(void*);Thread.cpp;40


    Gotta try to put the actual "draggingCopy.transform.position = globalMousePos;" bit in Update or something in case things happen in unexpected order for Unity when you move stuff in OnDrag.

    EDIT: Haven't been able to reproduce the crash after moving the "draggingCopy.transform.position = xxx" assignment to Update()

    EDIT2: Never mind. i guess it still happens
     
    Last edited: May 30, 2016
  17. subatomic

    subatomic

    Joined:
    Nov 13, 2014
    Posts:
    24
    Also seeing similar stack trace in 5.3.5p2. Happens randomly. We haven't found a way to reliably reproduce.
    http://forum.unity3d.com/threads/cr...oint3-tranformuivertices.357173/#post-2663156

    This crash used to also happen randomly in 5.3.2p2, 5.3.2p4, and 5.3.4p6... already documented here:
    This thread's stacktrace is similar (inside UIGeometryJob) to this one...
    http://forum.unity3d.com/threads/cr...oint3-tranformuivertices.357173/#post-2632299
    ...but doesn't have the functioncalls (MultiplyPoint3, TransformUIVertices, TransformUIVertices). They seem very related however.

    I'll submit a bug report if you give me a cloud upload link. (Big project)
     

    Attached Files:

    Last edited: Jun 6, 2016
  18. ScroodgeM

    ScroodgeM

    Joined:
    Jul 14, 2012
    Posts:
    3
    Looks like we found a solution which can help you too.

    We have some UI position calculations in LateUpdate() cycle. Once calculated, new positions and states (like fillAmount, color properties in sprites etc) are applied to UI transforms and components in LateUpdate() body immediately.

    In this implementation, we catch a crash randomly in UI::UIGeometryJob

    As far as I understand, unity UI thread already running when LateUpdate() executed and changing any UI transforms or components properties can change data which UI thread working with in his own thread

    So our solution was as simple as possible - we move all UI property/positions applying to Update() cycle

    Profit! Out app is not crashing anymore! I hope Unity will fix this bug in future releases, but this hint can save some hair on head 8)

    I think not only LateUpdate() can cause these crashes, but also some late-executing methods too (e.g. OnPostRender), so try to avoid any UI components changing anywhere except Update()
     
  19. NoseKills

    NoseKills

    Joined:
    Jun 4, 2013
    Posts:
    25
    Hmm... I guess I gotta double check if we are doing anything else to the UI components outside of Update().
     
    subatomic likes this.
  20. subatomic

    subatomic

    Joined:
    Nov 13, 2014
    Posts:
    24