Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-128374

Sporadic crash on QRhiMetal::enqueueSubresUpload()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.8.1, 6.9.0 FF
    • 6.7.2
    • Multimedia, Qt RHI
    • None
    • both Mac Intel and M1/M2
      different macOS versions
    • macOS
    • aadb05820 (dev), d7329f874 (6.8), 7756d875d (6.7)

    Description

      Here is sporadic crash on QRhiMetal::enqueueSubresUpload().
      I don't reproduce this locally, I just discovered it while investigating our users' crash reports on the AppCenter.

      Date/Time:       2024-08-24T11:08:26.999Z
      Launch Time:     2024-08-24T08:38:02Z
      OS Version:      Mac OS X 14.6.1 (23G93)
      Report Version:  104
      
      Exception Type:  SIGSEGV
      Exception Codes: SEGV_MAPERR at 0xc8
      Crashed Thread:  42
      
      Thread 42 Crashed:
      0   AGXMetal13_3                         0x00000001e7477b20 0x1e7265000 + 2173728
      1   AGXMetal13_3                         0x00000001e747b494 0x1e7265000 + 2188436
      2   QtGui                                0x000000010b0459a4 QRhiMetal::enqueueSubresUpload(QMetalTexture*, void*, void*, int, int, QRhiTextureSubresourceUploadDescription const&, long long*) (qrhimetal.mm:2679)
      3   QtGui                                0x000000010b0468c4 QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer*, QRhiResourceUpdateBatch*) (qrhimetal.mm:2781)
      4   QtQuick                              0x000000010a05d0c0 QSGBatchRenderer::Renderer::prepareRenderPass(QSGBatchRenderer::Renderer::RenderPassContext*) (qsgbatchrenderer.cpp:3834)
      5   QtQuick                              0x000000010a05c75c QSGBatchRenderer::Renderer::render() (qsgbatchrenderer.cpp:3575)
      6   QtQuick                              0x000000010a072970 QSGRenderer::renderScene() (qsgrenderer.cpp:143)
      7   QtQuick                              0x000000010a022874 QQuickWindowPrivate::renderSceneGraph() (qquickwindow.cpp:683)
      8   QtQuick                              0x000000010a1bf74c QSGRenderThread::syncAndRender() (qsgthreadedrenderloop.cpp:761)
      9   QtQuick                              0x000000010a1c07e4 QSGRenderThread::run() (qsgthreadedrenderloop.cpp:974)
      10  QtCore                               0x000000010bb03b10 QThreadPrivate::start(void*) (qthread_unix.cpp:326)
      11  libsystem_pthread.dylib              0x0000000190051f94 _pthread_start + 132
      12  libsystem_pthread.dylib              0x000000019004cd34 thread_start + 4
      

      From what I see, it usually happens at the moment when QML MediaPlayer is destroying on the main thread.

      Thread 0:
      0   CoreFoundation                       0x0000000190263b6c _CFXNotificationHandlerRelease + 60
      1   CoreFoundation                       0x0000000190266f70 _CFXNotificationRegistrarRecycleObserverRegistration + 412
      2   CoreFoundation                       0x00000001902651f8 _CFXNotificationRegistrarRemoveObservers + 132
      3   CoreFoundation                       0x00000001902650c0 _CFXNotificationRegistrarRemoveObjects + 160
      4   CoreFoundation                       0x0000000190264f10 _CFXNotificationRegistrarRemoveNames + 220
      5   CoreFoundation                       0x0000000190264d4c CFXNotificationRegistrarRemove + 292
      6   CoreFoundation                       0x000000019013255c _CFXNotificationRemoveObservers + 136
      7   CoreMedia                            0x000000019a6028ec FigNotificationCenterRemoveWeakListener + 224
      8   MediaToolbox                         0x000000019f6feed8 FigTTMLDocumentWriterCreateLineBreaker + 1708
      9   CoreMedia                            0x000000019a5fcb5c FigBaseObjectFinalize + 564
      10  CoreFoundation                       0x0000000190203e90 _CFRelease + 288
      11  CoreFoundation                       0x00000001900d3098 __RELEASE_OBJECTS_IN_THE_ARRAY__ + 112
      12  CoreFoundation                       0x00000001900d2fd4 -[__NSArrayM dealloc] + 144
      13  MediaToolbox                         0x000000019f660734 FigVideoRenderPipelineCreateWithVisualContextGroup + 1308
      14  CoreMedia                            0x000000019a5fcb5c FigBaseObjectFinalize + 564
      15  CoreFoundation                       0x0000000190203e90 _CFRelease + 288
      16  MediaToolbox                         0x000000019f652cec FigPlaybackBossIsInPausedState + 28816
      17  CoreFoundation                       0x0000000190203e90 _CFRelease + 288
      18  CoreFoundation                       0x00000001900f2de8 -[__NSArrayI dealloc] + 72
      19  MediaToolbox                         0x000000019f3e8558 FigPlaybackBossInvalidate + 672
      20  MediaToolbox                         0x000000019f5961f8 FigPlayerAsyncDispatchToPlayerQueue + 155432
      21  MediaToolbox                         0x000000019f5a8c04 FigPlayerAsyncDispatchToPlayerQueue + 231732
      22  MediaToolbox                         0x000000019f5a8e4c FigPlayerAsyncDispatchToPlayerQueue + 232316
      23  MediaToolbox                         0x000000019f5b11d4 FigPlayerAsyncDispatchToPlayerQueue + 265988
      24  MediaToolbox                         0x000000019f681420 FPSupport_GetMainDisplayVideoRangeAndSizeAndFrameRate + 13632
      25  MediaToolbox                         0x000000019f681338 FPSupport_GetMainDisplayVideoRangeAndSizeAndFrameRate + 13400
      26  MediaToolbox                         0x000000019fa15a94 FigPlayerSurrogateCreate + 2508
      27  MediaToolbox                         0x000000019f75a684 FigPlayerAirPlayCreate + 3940
      28  MediaToolbox                         0x000000019f6c539c FigPlayerCentralCreate + 3508
      29  MediaToolbox                         0x000000019f6815dc FPSupport_GetMainDisplayVideoRangeAndSizeAndFrameRate + 14076
      30  MediaToolbox                         0x000000019f5713d8 FigPlayerAsyncDispatchToPlayerQueue + 4360
      31  MediaToolbox                         0x000000019f5711c8 FigPlayerAsyncDispatchToPlayerQueue + 3832
      32  libdispatch.dylib                    0x000000018fea13e8 _dispatch_client_callout + 16
      33  libdispatch.dylib                    0x000000018feb08d8 _dispatch_lane_barrier_sync_invoke_and_complete + 52
      34  MediaToolbox                         0x000000019f574160 FigPlayerAsyncDispatchToPlayerQueue + 16016
      35  MediaToolbox                         0x000000019f681420 FPSupport_GetMainDisplayVideoRangeAndSizeAndFrameRate + 13632
      36  MediaToolbox                         0x000000019f681338 FPSupport_GetMainDisplayVideoRangeAndSizeAndFrameRate + 13400
      37  MediaToolbox                         0x000000019f5707c8 FigPlayerAsyncDispatchToPlayerQueue + 1272
      38  AVFCore                              0x00000001a5a4887c __69-[AVPlayer(AVPlayerAudioDeviceSupport) setAudioOutputDeviceUniqueID:]_block_invoke_2 + 184
      39  libdispatch.dylib                    0x000000018fea13e8 _dispatch_client_callout + 16
      40  libdispatch.dylib                    0x000000018feb08d8 _dispatch_lane_barrier_sync_invoke_and_complete + 52
      41  AVFCore                              0x00000001a5a48768 -[AVPlayer(AVPlayerAudioDeviceSupport) setAudioOutputDeviceUniqueID:] + 244
      42  libdarwinmediaplugin.dylib           0x00000003176dcc70 AVFMediaPlayer::audioOutputChanged() (avfmediaplayer.mm:945)
      43  libdarwinmediaplugin.dylib           0x00000003176de8f0 AVFMediaPlayer::setAudioOutput(QPlatformAudioOutput*) (avfmediaplayer.mm:759)
      44  QtMultimedia                         0x00000001092e98d0 QMediaPlayer::setAudioOutput(QAudioOutput*) (qmediaplayer.cpp:678)
      45  QtMultimedia                         0x00000001092e97d8 QMediaPlayer::~QMediaPlayer() (qmediaplayer.cpp:251)
      46  QtMultimediaQuick                    0x0000000317aed944 QQmlPrivate::QQmlElement<QQuickMediaPlayer>::~QQmlElement() (qquickmediaplayer_p.h:26)
      47  QtCore                               0x000000010b9d49e8 QObjectPrivate::deleteChildren() (qobject.cpp:2222)
      48  QtCore                               0x000000010b9d47e4 QObject::~QObject() (qobject.cpp:1172)
      49  QtQuick                              0x0000000109f7b848 QQuickItem::~QQuickItem() (qquickitem.cpp:2427)
      50  QtMultimediaQuick                    0x0000000317aee198 QQmlPrivate::QQmlElement<QQuickVideoOutput>::~QQmlElement() (qqmlprivate.h:100)
      51  QtCore                               0x000000010b9d5774 QObject::event(QEvent*) (qobject.cpp:5002)
      52  QtCore                               0x000000010b99198c QCoreApplicationPrivate::notify_helper(QObject*, QEvent*) (qcoreapplication.cpp:1316)
      53  QtCore                               0x000000010b99143c QCoreApplication::notifyInternal2(QObject*, QEvent*) (qcoreapplication.cpp:1142)
      54  QtCore                               0x000000010b992454 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (qcoreapplication.cpp:1583)
      55  libqcocoa.dylib                      0x000000010f97ebf4 QCocoaEventDispatcherPrivate::processPostedEvents() (qcocoaeventdispatcher.mm:900)
      56  libqcocoa.dylib                      0x000000010f97fd28 QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) (qcocoaeventdispatcher.mm:922)
      57  CoreFoundation                       0x00000001901314d8 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
      58  CoreFoundation                       0x000000019013146c __CFRunLoopDoSource0 + 172
      59  CoreFoundation                       0x00000001901311dc __CFRunLoopDoSources0 + 240
      60  CoreFoundation                       0x000000019012fdc8 __CFRunLoopRun + 824
      61  CoreFoundation                       0x000000019012f434 CFRunLoopRunSpecific + 604
      62  HIToolbox                            0x000000019a8d919c RunCurrentEventLoopInMode + 288
      63  HIToolbox                            0x000000019a8d8fd8 ReceiveNextEventCommon + 644
      64  HIToolbox                            0x000000019a8d8d30 _BlockUntilNextEventMatchingListInModeWithFilter + 72
      65  AppKit                               0x000000019398ecc8 _DPSNextEvent + 656
      66  AppKit                               0x00000001941854d0 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 696
      67  AppKit                               0x0000000193981ffc -[NSApplication run] + 472
      68  libqcocoa.dylib                      0x000000010f97d888 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qcocoaeventdispatcher.mm:406)
      69  QtCore                               0x000000010b99ad84 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:100)
      70  QtCore                               0x000000010b991b68 QCoreApplication::exec() (qcoreapplication.cpp:1486)
      

       
      So, most probably there is some sort of data race.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtmultimediateam Qt Multimedia Team
              studiosus Vladimir Belyavsky
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes