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

Deadlock in QDarwinAudioSource while stopping disconnected device

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 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

    Description

      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]

       

       

      Attachments

        1. audio-idle-crash.zip
          8 kB
          Marcin Lisowski
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            marcinlisowski Marcin Lisowski
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: