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

Deadlock in QDarwinAudioSource while stopping disconnected device

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1: Critical P1: Critical
    • 6.8.1
    • 6.5.3
    • Multimedia
    • None
    • MacBook Pro 2019, 2,6 GHz 6 Core Intel Core i7
      Sonoma 14.5
    • macOS
    • 04399a733 (dev), 3a8ba8e5f (dev), dad3635dd (dev), 4f7dab478 (dev), 05d9a7b0f (dev), 2e9e92483 (dev), 9bdf85719 (dev), 3e1433e5b (dev), b2f4c1f38 (dev), 84ab62bee (6.8), c81457b8e (6.8), 6869c8bb1 (6.8), c1c095e39 (6.8), 7db13f862 (6.8), 61823de02 (6.8)
    • Multimedia wk 41-42, Multimedia wk 43-44

      When using QAudioDevice from Qt Multimedia you can end up having a deadlock while destructing or simply stopping already disconnected audio device. Qt tries to stop audio thread and waits for it but it never signals.

      It doesn't happen on every mac device, however I find out it doesn't happen on M1 Max. 

      What I'm doing in more detail:

      1. Open QAudioDevice and begin reading audio input data
      2. Disconnect audio device physically
      3. QMediaDevices::audioInputsChanged signal is triggered
      4. In this signal I identify my device is no longer existing and I'm stopping or destroying QAudioDevice object
      5. It hangs in deadlock
      * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
        * frame #0: 0x00007ff807bd9f7a libsystem_kernel.dylib`__psynch_cvwait + 10
          frame #1: 0x00007ff807c176f3 libsystem_pthread.dylib`_pthread_cond_wait + 1211
          frame #2: 0x0000000102ebfcab QtCore`QWaitConditionPrivate::wait(this=0x00007fb41e626e40, deadline=<unavailable>) at qwaitcondition_unix.cpp:87:24 [opt]
          frame #3: 0x0000000102ebfc1e QtCore`QWaitCondition::wait(this=0x00007fb41e626d08, mutex=0x00007fb41e626d00, deadline=(t1 = 9223372036854775807, t2 = 0, type = 1)) at qwaitcondition_unix.cpp:160:27 [opt]
          frame #4: 0x0000000102133b64 QtMultimedia`QDarwinAudioSource::stop() [inlined] QDarwinAudioSourceBuffer::wait(this=<unavailable>) at qdarwinaudiosource_p.h:111:36 [opt]
          frame #5: 0x0000000102133b43 QtMultimedia`QDarwinAudioSource::stop() [inlined] QDarwinAudioSource::audioThreadStop(this=0x00007fb417039d60) at qdarwinaudiosource.mm:856:24 [opt]
          frame #6: 0x0000000102133b1b QtMultimedia`QDarwinAudioSource::stop(this=0x00007fb417039d60) at qdarwinaudiosource.mm:726:9 [opt]

       

       

        For Gerrit Dashboard: QTBUG-126816
        # Subject Branch Project Status CR V

            artemiy Artem Dyomin
            marcinlisowski Marcin Lisowski
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: