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

EXC_BREAKPOINT in QDarwinAudioSink::renderCallback while stopping

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.4.2
    • Multimedia
    • TestFlight-installed beta, on iPad Pro (11 inch), iOS 15.5
    • iOS/tvOS/watchOS

    Description

      I have a crash report from a beta tester, data below. They reported that the app crashed upon switching between apps (presumably switching away from my app as the threads indicate that the audio was stopping).

      My app uses a QAudioSink set up as follows during app start up:

      QMediaDevices mediaDevices;
      QAudioDevice defaultAudioDevice = mediaDevices.defaultAudioOutput();
      _audioFormat = defaultAudioDevice.preferredFormat();
      _audioSink = new QAudioSink(_audioFormat);
      // Start QAudioSink in pull mode, providing `device`, a subclassed QIODevice*
      _audioSink->start(device);
      

      As you'll see from the data below, the app crashed a day after it was started. It was reported as having behaved correctly until the crash. So we can safely infer that the app had gone into suspended state on multiple occasions before the time it crashed.

      Thread 7 suggests that my app was in the process of stopping audio: you can see QDarwinAudioSink::stop() + 132 in the stack trace. This was called from:

      void AudioSinkContainer::stop()
      {
          if (_audioSink == nullptr)
              return;
      
          _audioSink->stop();
          disconnect(_audioSink, &QAudioSink::stateChanged, this, &AudioSinkContainer::setAudioState);
          _audioSink->deleteLater();
          _audioSink = nullptr;
      }
      

      The crash happens in thread 10 during QDarwinAudioSink::renderCallback(void*, unsigned int*, AudioTimeStamp const*, unsigned int, unsigned int, AudioBufferList*) + 84.

      Excepts from crash report

      ...
      Hardware Model:      iPad8,3
      
      ...
      AppStoreTools:       15C5500a
      AppVariant:          1:iPad8,3:15
      Beta:                YES
      Code Type:           ARM-64 (Native)
      Role:                Foreground
      Parent Process:      launchd [1]
      ...
      Date/Time:           2024-03-11 15:16:25.3525 +0000
      Launch Time:         2024-03-10 18:22:51.9987 +0000
      OS Version:          iPhone OS 15.5 (19F77)
      Release Type:        User
      Baseband Version:    4.04.02
      Report Version:      104
      
      Exception Type:  EXC_BREAKPOINT (SIGTRAP)
      Exception Codes: 0x0000000000000001, 0x00000001eb7a7054
      Exception Note:  EXC_CORPSE_NOTIFY
      Termination Reason: SIGNAL 5 Trace/BPT trap: 5
      Terminating Process: exc handler [383]
      
      Triggered by Thread:  10
      
      
      Thread 0 name:
      Thread 0:
      0   libsystem_kernel.dylib        	0x00000001b73714a0 mach_msg_trap + 8 (:-1)
      1   libsystem_kernel.dylib        	0x00000001b7371ae4 mach_msg + 76 (mach_msg.c:119)
      2   CoreFoundation                	0x00000001803ffd30 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
      3   CoreFoundation                	0x00000001804041bc __CFRunLoopRun + 1180 (CFRunLoop.c:3000)
      4   CoreFoundation                	0x0000000180417bc8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
      5   GraphicsServices              	0x000000019c54b374 GSEventRunModal + 164 (GSEvent.c:2200)
      6   UIKitCore                     	0x0000000182d87648 -[UIApplication _run] + 1100 (UIApplication.m:3511)
      7   UIKitCore                     	0x0000000182b08d90 UIApplicationMain + 364 (UIApplication.m:5064)
      8   Clarion                       	0x000000010381c490 qt_main_wrapper + 828
      9   dyld                          	0x0000000105f89ce4 start + 520 (dyldMain.cpp:879)
      
      Thread 1 name:
      Thread 1:
      0   libsystem_kernel.dylib        	0x00000001b73714a0 mach_msg_trap + 8 (:-1)
      1   libsystem_kernel.dylib        	0x00000001b7371ae4 mach_msg + 76 (mach_msg.c:119)
      2   CoreFoundation                	0x00000001803ffd30 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
      3   CoreFoundation                	0x00000001804041bc __CFRunLoopRun + 1180 (CFRunLoop.c:3000)
      4   CoreFoundation                	0x0000000180417bc8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
      5   Foundation                    	0x0000000181c06464 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 236 (NSRunLoop.m:373)
      6   Foundation                    	0x0000000181c47e2c -[NSRunLoop(NSRunLoop) runUntilDate:] + 92 (NSRunLoop.m:420)
      7   UIKitCore                     	0x0000000182d01770 -[UIEventFetcher threadMain] + 524 (UIEventFetcher.m:1167)
      8   Foundation                    	0x0000000181c5643c __NSThread__start__ + 808 (NSThread.m:972)
      9   libsystem_pthread.dylib       	0x00000001f0b309ac _pthread_start + 148 (pthread.c:891)
      10  libsystem_pthread.dylib       	0x00000001f0b2fe68 thread_start + 8 (:-1)
      
      Thread 2 name:
      Thread 2:
      0   libsystem_kernel.dylib        	0x00000001b7374ba4 poll + 8 (:-1)
      1   Clarion                       	0x0000000102ea3954 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 468
      2   Clarion                       	0x0000000102ea4ca4 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 736
      3   Clarion                       	0x0000000102da220c QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 600
      4   Clarion                       	0x0000000102e55854 QThread::exec() + 256
      5   Clarion                       	0x00000001030c8f10 QQmlThreadPrivate::run() + 124
      6   Clarion                       	0x0000000102ea8b28 QThreadPrivate::start(void*) + 352
      7   libsystem_pthread.dylib       	0x00000001f0b309ac _pthread_start + 148 (pthread.c:891)
      8   libsystem_pthread.dylib       	0x00000001f0b2fe68 thread_start + 8 (:-1)
      
      Thread 3 name:
      Thread 3:
      0   libsystem_kernel.dylib        	0x00000001b7374ba4 poll + 8 (:-1)
      1   Clarion                       	0x0000000102ea3954 qt_safe_poll(pollfd*, unsigned int, timespec const*) + 468
      2   Clarion                       	0x0000000102ea4ca4 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 736
      3   Clarion                       	0x0000000102da220c QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 600
      4   Clarion                       	0x0000000102e55854 QThread::exec() + 256
      5   Clarion                       	0x0000000102ea8b28 QThreadPrivate::start(void*) + 352
      6   libsystem_pthread.dylib       	0x00000001f0b309ac _pthread_start + 148 (pthread.c:891)
      7   libsystem_pthread.dylib       	0x00000001f0b2fe68 thread_start + 8 (:-1)
      
      ...
      
      Thread 7 name:
      Thread 7:
      0   libsystem_kernel.dylib        	0x00000001b7371f24 __psynch_cvwait + 8 (:-1)
      1   libsystem_pthread.dylib       	0x00000001f0b37298 _pthread_cond_wait + 1236 (pthread_cond.c:636)
      2   Clarion                       	0x0000000102eb1584 QWaitConditionPrivate::wait_relative(QDeadlineTimer) + 280
      3   Clarion                       	0x0000000102eb1398 QWaitConditionPrivate::wait(QDeadlineTimer) + 92
      4   Clarion                       	0x0000000102eb1168 QWaitCondition::wait(QMutex*, unsigned long) + 224
      5   Clarion                       	0x0000000103e1be68 QDarwinAudioSink::stop() + 132
      6   Clarion                       	0x000000010387ec4c AudioSinkContainer::stop() + 32
      7   Clarion                       	0x0000000102dd6358 void doActivate<false>(QObject*, int, void**) + 852
      8   Clarion                       	0x0000000102dd1330 QObject::event(QEvent*) + 716
      9   Clarion                       	0x0000000102d9ae54 QCoreApplicationPrivate::notify_helper(QObject*, QEvent*) + 384
      10  Clarion                       	0x0000000102d9ac1c QCoreApplication::notifyInternal2(QObject*, QEvent*) + 292
      11  Clarion                       	0x0000000102d9bcfc QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) + 1572
      12  Clarion                       	0x0000000102ea4a18 QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 84
      13  Clarion                       	0x0000000102da220c QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 600
      14  Clarion                       	0x0000000102e55854 QThread::exec() + 256
      15  Clarion                       	0x0000000102ea8b28 QThreadPrivate::start(void*) + 352
      16  libsystem_pthread.dylib       	0x00000001f0b309ac _pthread_start + 148 (pthread.c:891)
      17  libsystem_pthread.dylib       	0x00000001f0b2fe68 thread_start + 8 (:-1)
      
      Thread 8 name:
      Thread 8:
      0   libsystem_kernel.dylib        	0x00000001b73714a0 mach_msg_trap + 8 (:-1)
      1   libsystem_kernel.dylib        	0x00000001b7371ae4 mach_msg + 76 (mach_msg.c:119)
      2   CoreFoundation                	0x00000001803ffd30 __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
      3   CoreFoundation                	0x00000001804041bc __CFRunLoopRun + 1180 (CFRunLoop.c:3000)
      4   CoreFoundation                	0x0000000180417bc8 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
      5   AudioSession                  	0x0000000189a23f04 CADeprecated::GenericRunLoopThread::Entry(void*) + 164 (GenericRunLoopThread.h:95)
      6   AudioSession                  	0x0000000189a2d8f0 CADeprecated::CAPThread::Entry(CADeprecated::CAPThread*) + 92 (CAPThread.cpp:324)
      7   libsystem_pthread.dylib       	0x00000001f0b309ac _pthread_start + 148 (pthread.c:891)
      8   libsystem_pthread.dylib       	0x00000001f0b2fe68 thread_start + 8 (:-1)
      
      Thread 9 name:
      Thread 9:
      0   AGXMetalA12                   	0x00000001f13811e8 AGX::RenderContext<AGX::G11::Encoders, AGX::G11::Classes, AGX::G11::ObjClasses>::encodeAndEmitRenderState(AGX::G11::VertexProgramVariant const*, AGX::G11::FragmentProgramVariant const*, AGX::Argume... + 444 (agxs_bindpoint_layout.h:358)
      1   AGXMetalA12                   	0x00000001f1381194 AGX::RenderContext<AGX::G11::Encoders, AGX::G11::Classes, AGX::G11::ObjClasses>::encodeAndEmitRenderState(AGX::G11::VertexProgramVariant const*, AGX::G11::FragmentProgramVariant const*, AGX::Argume... + 360 (agxa_render_template.hpp:0)
      2   AGXMetalA12                   	0x00000001f1384388 -[AGXA12FamilyRenderContext drawIndexedPrimitives:indexCount:indexType:indexBuffer:indexBufferOffset:instanceCount:baseVertex:baseInstance:] + 456 (agxa_render_template.h:332)
      3   Clarion                       	0x000000010419ca10 QRhiMetal::drawIndexed(QRhiCommandBuffer*, unsigned int, unsigned int, unsigned int, int, unsigned int) + 152
      4   Clarion                       	0x0000000103321f50 QSGBatchRenderer::Renderer::renderUnmergedBatch(QSGBatchRenderer::Renderer::PreparedRenderBatch*, bool) + 388
      5   Clarion                       	0x000000010332422c QSGBatchRenderer::Renderer::recordRenderPass(QSGBatchRenderer::Renderer::RenderPassContext*) + 292
      6   Clarion                       	0x0000000103321fd0 QSGBatchRenderer::Renderer::render() + 92
      7   Clarion                       	0x000000010333735c QSGRenderer::renderScene() + 344
      8   Clarion                       	0x00000001032f1794 QQuickWindowPrivate::renderSceneGraph(QSize const&, QSize const&) + 780
      9   Clarion                       	0x000000010344fc28 QSGRenderThread::syncAndRender() + 956
      10  Clarion                       	0x0000000103450b5c QSGRenderThread::run() + 288
      11  Clarion                       	0x0000000102ea8b28 QThreadPrivate::start(void*) + 352
      12  libsystem_pthread.dylib       	0x00000001f0b309ac _pthread_start + 148 (pthread.c:891)
      13  libsystem_pthread.dylib       	0x00000001f0b2fe68 thread_start + 8 (:-1)
      
      Thread 10 name:
      Thread 10 Crashed:
      0   caulk                         	0x00000001eb7a7054 caulk::thread::join() + 104 (thread.cpp:102)
      1   libEmbeddedSystemAUs.dylib    	0x00000001bc1c3064 std::__1::__shared_ptr_emplace<AURemoteIO::IOThread, std::__1::allocator<AURemoteIO::IOThread> >::__on_zero_shared() + 36 (AURemoteIO.h:300)
      2   libEmbeddedSystemAUs.dylib    	0x00000001bc2002e4 std::__1::__shared_weak_count::__release_shared() + 84 (shared_ptr.h:177)
      3   libEmbeddedSystemAUs.dylib    	0x00000001bc1ce02c AURemoteIO::Stop() + 1564 (shared_ptr.h:959)
      4   libEmbeddedSystemAUs.dylib    	0x00000001bc1c12fc ausdk::AUMethodStop(void*) + 120 (AUPlugInDispatch.cpp:478)
      5   Clarion                       	0x0000000103e1c248 QDarwinAudioSink::renderCallback(void*, unsigned int*, AudioTimeStamp const*, unsigned int, unsigned int, AudioBufferList*) + 84
      6   libEmbeddedSystemAUs.dylib    	0x00000001bc1d93ac ausdk::AUInputElement::PullInput(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 176 (AUInputElement.h:69)
      7   libEmbeddedSystemAUs.dylib    	0x00000001bc1c03d4 AUInputFormatConverter2::InputProc(OpaqueAudioConverter*, unsigned int*, AudioBufferList*, AudioStreamPacketDescription**, void*) + 160 (AUInputFormatConverter2.h:300)
      8   AudioToolboxCore              	0x0000000193802edc acv1::AudioConverterChain::CallInputProc(unsigned int) + 436 (v1_CompositeAudioConverter.cpp:1228)
      9   AudioToolboxCore              	0x000000019381c448 acv1::AudioConverterChain::FillBufferFromInputProc(unsigned int*, CADeprecated::CABufferList*) + 428 (v1_CompositeAudioConverter.cpp:1123)
      10  AudioToolboxCore              	0x000000019382ee94 acv1::BufferedAudioConverter::GetInputBytes(unsigned int, unsigned int&, CADeprecated::CABufferList const*&) + 220 (v1_BufferedAudioConverter.cpp:225)
      11  AudioToolboxCore              	0x0000000193802a1c acv1::CBRConverter::RenderOutput(CADeprecated::CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 148 (v1_CBRConverter.cpp:115)
      12  AudioToolboxCore              	0x00000001938135a8 acv1::BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 416 (v1_BufferedAudioConverter.cpp:152)
      13  AudioToolboxCore              	0x000000019382ee64 acv1::BufferedAudioConverter::GetInputBytes(unsigned int, unsigned int&, CADeprecated::CABufferList const*&) + 172 (v1_BufferedAudioConverter.cpp:221)
      14  AudioToolboxCore              	0x0000000193927324 acv1::Resampler2Wrapper::RenderOutput(CADeprecated::CABufferList*, unsigned int, unsigned int&) + 248 (v1_Resampler2SRCKernel.cpp:209)
      15  AudioToolboxCore              	0x00000001939f4ba0 acv1::SampleRateConverter::RenderOutput(CADeprecated::CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 76 (v1_SampleRateConverter.cpp:737)
      16  AudioToolboxCore              	0x00000001938135a8 acv1::BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 416 (v1_BufferedAudioConverter.cpp:152)
      17  AudioToolboxCore              	0x000000019381f304 acv1::AudioConverterChain::RenderOutput(CADeprecated::CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 148 (v1_CompositeAudioConverter.cpp:944)
      18  AudioToolboxCore              	0x00000001938135a8 acv1::BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 416 (v1_BufferedAudioConverter.cpp:152)
      19  AudioToolboxCore              	0x00000001938043c8 acv1::_AudioConverterFillComplexBuffer(OpaqueAudioConverter*, int (*)(OpaqueAudioConverter*, unsigned int*, AudioBufferList*, AudioStreamPacketDescription**, void*), void*, unsigned int*, AudioBuff... + 796 (v1_AudioConverter.cpp:349)
      20  libEmbeddedSystemAUs.dylib    	0x00000001bc1cc890 AUConverterBase::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 712 (AUInputFormatConverter2.h:234)
      21  libEmbeddedSystemAUs.dylib    	0x00000001bc1c61a0 AURemoteIO::RenderBus(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int) + 196 (AURemoteIO.cpp:1935)
      22  libEmbeddedSystemAUs.dylib    	0x00000001bc1b5434 ausdk::AUBase::DoRender(unsigned int&, AudioTimeStamp const&, unsigned int, unsigned int, AudioBufferList&) + 1548 (AUBase.h:549)
      23  libEmbeddedSystemAUs.dylib    	0x00000001bc1b6678 AURemoteIO::PerformIO(unsigned int, unsigned int, unsigned int, AudioTimeStamp const&, AudioTimeStamp const&, AudioBufferList const*, AudioBufferList*, int&) + 1332 (AURemoteIO.cpp:1899)
      24  libEmbeddedSystemAUs.dylib    	0x00000001bc1bf6ac _XPerformIO + 340 (AURemoteIO.cpp:2307)
      25  libAudioToolboxUtility.dylib  	0x0000000199b3ac54 mshMIGPerform + 264 (MachServerHelper.c:450)
      26  libAudioToolboxUtility.dylib  	0x0000000199b3a39c MSHMIGDispatchMessage + 40 (MachServerHelper.c:521)
      27  libEmbeddedSystemAUs.dylib    	0x00000001bc1b5f50 void* caulk::thread_proxy<std::__1::tuple<caulk::thread::attributes, AURemoteIO::IOThread::IOThread(AURemoteIO&, caulk::thread::attributes const&, caulk::mach::os_workgroup const&)::'lambda'(), std... + 572 (AURemoteIO.cpp:2041)
      28  libsystem_pthread.dylib       	0x00000001f0b309ac _pthread_start + 148 (pthread.c:891)
      29  libsystem_pthread.dylib       	0x00000001f0b2fe68 thread_start + 8 (:-1)
      ...
      

      Attachments

        Issue Links

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

          Activity

            People

              tpochep Timur Pocheptsov
              paulmasri Paul
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes