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

tst_qfeedbackmmk autotest segfaults with pulseaudio backend

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.0.0
    • 5.0.0
    • Multimedia, Other
    • None
    • Ubuntu 10.04 32-bit
      qtbase 45d37022956238273d1afcd7f2083c844987e933
      qtmultimedia d0655b3ced1cb8aa74f84dcb15a8cccb24564971
      qtfeedback 4af42257b6890c61ef3e7246f2596a336b50a905
    • 0e021ea4d1db86708ec6ae5eafb661f1e8b7d631

    Description

      The tst_qfeedbackmmk autotest segfaults when the pulseaudio qtmultimedia backend is used. I think the bug is in qtmultimedia.

      Here is a log of the test failure.
      I have enabled QT_PA_DEBUG (and made it compile) to get more details of the failure.

      make: Entering directory `/home/rmcgover/build/qt/qt5/qtfeedback/tests/auto/qfeedbackmmk'
      valgrind --tool=memcheck ./qfeedbackmmk 
      (irrelevant valgrind output snipped)
      ********* Start testing of tst_QFeedbackMMK *********
      Config: Using QTest library 5.0.0, Qt 5.0.0
      PASS   : tst_QFeedbackMMK::initTestCase()
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setSource =  QUrl( "file:///home/rmcgover/build/qt/qt5/qtfeedback/tests/auto/qfeedbackmmk/test.wav" )  
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stop 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setPlaying( false ) 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setStatus 1 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) sampleReady 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) createPulseStream 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) pulse stream creating 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) pulse stream ready 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_write_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) uploadSample: return due to 0 m_runningCount 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_adjust_prebuffer_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) streamReady 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) updateVolume = 65536 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) m_sinkInputId = 533 tlength = 48000 maxlength = 4194304 minreq =  3840 prebuf = 38272 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) prepare(): writable size = 48000 actual writeBytes = 38272 m_playQueued = false 
      QDEBUG : tst_QFeedbackMMK::goodFile() stream_write_done_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setStatus 2 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setmuted_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) play 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) playSample 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setPlaying( true ) 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setvolume_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_write_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) uploadSample: m_runningCount = 1 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_write_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) uploadSample: return due to 0 m_runningCount 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_write_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) uploadSample: return due to 0 m_runningCount 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_write_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) uploadSample: return due to 0 m_runningCount 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_write_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) uploadSample: return due to 0 m_runningCount 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_write_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) uploadSample: return due to 0 m_runningCount 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_write_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) uploadSample: return due to 0 m_runningCount 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_underrun_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stop 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setPlaying( false ) 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stream_flush_callback 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) play 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) play deferred 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setPlaying( true ) 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) stop 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) setPlaying( false ) 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6b51680) setSource =  QUrl( "file:///home/rmcgover/build/qt/qt5/qtfeedback/tests/auto/qfeedbackmmk/test.wav" )  
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6b51680) stop 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6b51680) setPlaying( false ) 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6b51680) setStatus 1 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6b51680) sampleReady 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6b51680) createPulseStream 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6b51680) pulse stream creating 
      QDEBUG : tst_QFeedbackMMK::goodFile() QSoundEffectPrivate(0x6afbe98) unloadPulseStream 
      ==14336== Invalid read of size 4
      ==14336==    at 0x473F599: QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::operator->() const (qscopedpointer.h:112)
      ==14336==    by 0x48BC7D3: QObject::metaObject() const (moc_qobject.cpp:110)
      ==14336==    by 0x48BC43D: operator<<(QDebug, QObject const*) (qobject.cpp:3778)
      ==14336==    by 0x75DDC41: QSoundEffectPrivate::stream_flush_callback(pa_stream*, int, void*) (qsoundeffect_pulse_p.cpp:941)
      ==14336==    by 0x766BF31: (within /usr/lib/libpulse.so.0.12.2)
      ==14336==    by 0x76D5B34: (within /usr/lib/libpulsecommon-0.9.21.so)
      ==14336==    by 0x76D63B5: pa_pdispatch_run (in /usr/lib/libpulsecommon-0.9.21.so)
      ==14336==    by 0x7653318: (within /usr/lib/libpulse.so.0.12.2)
      ==14336==    by 0x76DAC47: (within /usr/lib/libpulsecommon-0.9.21.so)
      ==14336==    by 0x76C5CFD: (within /usr/lib/libpulsecommon-0.9.21.so)
      ==14336==    by 0x766350A: pa_mainloop_dispatch (in /usr/lib/libpulse.so.0.12.2)
      ==14336==    by 0x7663A20: pa_mainloop_iterate (in /usr/lib/libpulse.so.0.12.2)
      ==14336==  Address 0x6afbe9c is 4 bytes inside a block of size 72 free'd
      ==14336==    at 0x40249FA: operator delete(void*) (vg_replace_malloc.c:342)
      ==14336==    by 0x75DA4C3: QSoundEffectPrivate::~QSoundEffectPrivate() (qsoundeffect_pulse_p.cpp:304)
      ==14336==    by 0x48B7441: QObjectPrivate::deleteChildren() (qobject.cpp:1742)
      ==14336==    by 0x48B59CC: QObject::~QObject() (qobject.cpp:908)
      ==14336==    by 0x75DF00E: QSoundEffect::~QSoundEffect() (qsoundeffect.cpp:177)
      ==14336==    by 0x48BC571: qDeleteInEventHandler(QObject*) (qobject.cpp:4032)
      ==14336==    by 0x48B657D: QObject::event(QEvent*) (qobject.cpp:1099)
      ==14336==    by 0x4893C98: QCoreApplicationPrivate::notify_helper(QObject*, QEvent*) (qcoreapplication.cpp:957)
      ==14336==    by 0x4893A51: QCoreApplication::notify(QObject*, QEvent*) (qcoreapplication.cpp:903)
      ==14336==    by 0x42CFF4E: QGuiApplication::notify(QObject*, QEvent*) (qguiapplication.cpp:515)
      ==14336==    by 0x4893987: QCoreApplication::notifyInternal(QObject*, QEvent*) (qcoreapplication.cpp:832)
      ==14336==    by 0x42B84AC: QCoreApplication::sendEvent(QObject*, QEvent*) (qcoreapplication.h:208)
      QFATAL : tst_QFeedbackMMK::goodFile() ASSERT: "d" in file ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h, line 112
      FAIL!  : tst_QFeedbackMMK::goodFile() Received a fatal error.
         Loc: [Unknown file(0)]
      Totals: 1 passed, 1 failed, 0 skipped
      ********* Finished testing of tst_QFeedbackMMK *********
      

      It seems to me the problem is that the stream_flush_callback can be called with a dangling pointer, if the QSoundEffect object is deleted after the pa_stream_flush has begun but before it has completed successfully. Other PA callbacks might also suffer from this issue.

      Note I believe this crash would have been triggered by qtbase b4d23e61ed19c770caf6b993a8ab0e4474d3f417 , which changes QTest::qWait to also process DeferredDelete events (just as an app's main event loop would). Prior to that change, the soundEffect->deleteLater() in the feedback mmk plugin was effectively a no-op as far as the test was concerned.

      Attachments

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

        Activity

          People

            ling.hu@nokia.com Ling Hu (closed Nokia identity) (Inactive)
            rmcgover Rohan McGovern (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes