Bug 363291 - Plasma crashed after audio device shutdown in pulseaudio
Summary: Plasma crashed after audio device shutdown in pulseaudio
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: master
Platform: Gentoo Packages Linux
: NOR crash
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords: drkonqi
: 372617 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-05-19 19:34 UTC by Aleksei
Modified: 2016-11-20 12:00 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aleksei 2016-05-19 19:34:37 UTC
Application: plasmashell (5.6.90)
 (Compiled from sources)
Qt Version: 5.6.0
Frameworks Version: 5.22.0
Operating System: Linux 4.5.3-gentoo x86_64
Distribution: "NAME=Gentoo"

-- Information about the crash:
- What I was doing when the application crashed:
I went to audio settings GUI (pulseaudio) and disables one of the output devices (build in audio adapter) after that plasma crashed. I had a USB headset plugged in and detected by pulseaudio prior to that if it matters.

-- Backtrace:
Application: Plasma (plasmashell), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fc89c259800 (LWP 5237))]

Thread 11 (Thread 0x7fc887f35700 (LWP 5249)):
#0  0x00007fc896deb9dd in poll () from /lib64/libc.so.6
#1  0x00007fc89ae80a72 in _xcb_conn_wait () from /usr/lib64/libxcb.so.1
#2  0x00007fc89ae82667 in xcb_wait_for_event () from /usr/lib64/libxcb.so.1
#3  0x00007fc889c88169 in QXcbEventReader::run() () from /usr/lib64/libQt5XcbQpa.so.5
#4  0x00007fc897541dbb in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#6  0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 10 (Thread 0x7fc886625700 (LWP 5253)):
#0  0x00007fc896deb9dd in poll () from /lib64/libc.so.6
#1  0x00007fc893fa719c in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fc893fa72ac in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fc897724f6b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#4  0x00007fc8976d707a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fc89753da24 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#6  0x00007fc89c7eb335 in QDBusConnectionManager::run() () from /usr/lib64/libQt5DBus.so.5
#7  0x00007fc897541dbb in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#8  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#9  0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 9 (Thread 0x7fc884dd5700 (LWP 5324)):
#0  0x00007fc893fa6be5 in g_main_context_check () from /usr/lib64/libglib-2.0.so.0
#1  0x00007fc893fa7140 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fc893fa72ac in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fc897724f6b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#4  0x00007fc8976d707a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fc89753da24 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#6  0x00007fc899d356c5 in QQmlThreadPrivate::run() () from /usr/lib64/libQt5Qml.so.5
#7  0x00007fc897541dbb in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#8  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#9  0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 8 (Thread 0x7fc876d85700 (LWP 5343)):
#0  0x00007fc893fe9c31 in g_mutex_lock () from /usr/lib64/libglib-2.0.so.0
#1  0x00007fc893fa6979 in g_main_context_query () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fc893fa7117 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fc893fa72ac in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#4  0x00007fc897724f6b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fc8976d707a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#6  0x00007fc89753da24 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#7  0x00007fc899d356c5 in QQmlThreadPrivate::run() () from /usr/lib64/libQt5Qml.so.5
#8  0x00007fc897541dbb in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#9  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#10 0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 7 (Thread 0x7fc87509d700 (LWP 5406)):
#0  0x00007fc896602ebf in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fc89c14f6a4 in QTWTF::TCMalloc_PageHeap::scavengerThread() () from /usr/lib64/libQt5Script.so.5
#2  0x00007fc89c14f6e9 in QTWTF::TCMalloc_PageHeap::runScavengerThread(void*) () from /usr/lib64/libQt5Script.so.5
#3  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#4  0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 6 (Thread 0x7fc7e8125700 (LWP 5428)):
#0  0x00007fc896602ebf in pthread_cond_wait () from /lib64/libpthread.so.0
#1  0x00007fc7ef9ed8a3 in radeon_drm_cs_emit_ioctl () from /usr/lib64/dri/r600_dri.so
#2  0x00007fc7ef9ecff7 in impl_thrd_routine () from /usr/lib64/dri/r600_dri.so
#3  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#4  0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 5 (Thread 0x7fc7e36ed700 (LWP 5450)):
#0  0x00007fc893fa67b1 in g_main_context_prepare () from /usr/lib64/libglib-2.0.so.0
#1  0x00007fc893fa70cb in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fc893fa72ac in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fc897724f6b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#4  0x00007fc8976d707a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fc89753da24 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#6  0x00007fc89a6bb806 in QQuickPixmapReader::run() () from /usr/lib64/libQt5Quick.so.5
#7  0x00007fc897541dbb in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#8  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#9  0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 4 (Thread 0x7fc7d1145700 (LWP 8635)):
#0  0x00007fc896deb9dd in poll () from /lib64/libc.so.6
#1  0x00007fc893fa719c in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fc893fa72ac in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fc897724f6b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#4  0x00007fc8976d707a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fc89753da24 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#6  0x00007fc899d356c5 in QQmlThreadPrivate::run() () from /usr/lib64/libQt5Qml.so.5
#7  0x00007fc897541dbb in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#8  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#9  0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 3 (Thread 0x7fc7d0144700 (LWP 8642)):
#0  0x00007fc893fe9c31 in g_mutex_lock () from /usr/lib64/libglib-2.0.so.0
#1  0x00007fc893fa6979 in g_main_context_query () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fc893fa7117 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fc893fa72ac in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#4  0x00007fc897724f6b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#5  0x00007fc8976d707a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#6  0x00007fc89753da24 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#7  0x00007fc899d356c5 in QQmlThreadPrivate::run() () from /usr/lib64/libQt5Qml.so.5
#8  0x00007fc897541dbb in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#9  0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#10 0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7fc7d1b56700 (LWP 8643)):
#0  0x00007fc896de7add in read () from /lib64/libc.so.6
#1  0x00007fc893fe89d0 in g_wakeup_acknowledge () from /usr/lib64/libglib-2.0.so.0
#2  0x00007fc893fa6c94 in g_main_context_check () from /usr/lib64/libglib-2.0.so.0
#3  0x00007fc893fa7140 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#4  0x00007fc893fa72ac in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#5  0x00007fc897724f6b in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#6  0x00007fc8976d707a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#7  0x00007fc89753da24 in QThread::exec() () from /usr/lib64/libQt5Core.so.5
#8  0x00007fc899d356c5 in QQmlThreadPrivate::run() () from /usr/lib64/libQt5Qml.so.5
#9  0x00007fc897541dbb in QThreadPrivate::start(void*) () from /usr/lib64/libQt5Core.so.5
#10 0x00007fc8965fd3fc in start_thread () from /lib64/libpthread.so.0
#11 0x00007fc896df481d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7fc89c259800 (LWP 5237)):
[KCrash Handler]
#6  0x00007fc899c0ca73 in toVariant(QV4::ExecutionEngine*, QV4::Value const&, int, bool, QSet<QV4::Heap::Object*>*) () from /usr/lib64/libQt5Qml.so.5
#7  0x00007fc899c0d174 in QV4::ExecutionEngine::toVariant(QV4::Value const&, int, bool) () from /usr/lib64/libQt5Qml.so.5
#8  0x00007fc899d21e23 in QQmlBinding::write(QQmlPropertyData const&, QV4::Value const&, bool, QFlags<QQmlPropertyPrivate::WriteFlag>) () from /usr/lib64/libQt5Qml.so.5
#9  0x00007fc899d22f72 in QQmlBinding::update(QFlags<QQmlPropertyPrivate::WriteFlag>) () from /usr/lib64/libQt5Qml.so.5
#10 0x00007fc899d233be in QQmlBinding::refresh() () from /usr/lib64/libQt5Qml.so.5
#11 0x00007fc899cfb2a5 in QQmlNotifier::emitNotify(QQmlNotifierEndpoint*, void**) () from /usr/lib64/libQt5Qml.so.5
#12 0x00007fc899ca8c14 in QQmlData::signalEmitted(QAbstractDeclarativeData*, QObject*, int, void**) () from /usr/lib64/libQt5Qml.so.5
#13 0x00007fc8976fe884 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#14 0x00007fc899b19da1 in VDMModelDelegateDataType::notify(QQmlAdaptorModel const&, QList<QQmlDelegateModelItem*> const&, int, int, QVector<int> const&) const () from /usr/lib64/libQt5Qml.so.5
#15 0x00007fc899d57d8a in QQmlDelegateModel::_q_itemsChanged(int, int, QVector<int> const&) () from /usr/lib64/libQt5Qml.so.5
#16 0x00007fc899d5c477 in QQmlDelegateModel::_q_layoutChanged(QList<QPersistentModelIndex> const&, QAbstractItemModel::LayoutChangeHint) () from /usr/lib64/libQt5Qml.so.5
#17 0x00007fc899d7ec9f in QQmlDelegateModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib64/libQt5Qml.so.5
#18 0x00007fc899d7f3f8 in QQmlDelegateModel::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib64/libQt5Qml.so.5
#19 0x00007fc8976feee0 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#20 0x00007fc89776c0a6 in QAbstractItemModel::layoutChanged(QList<QPersistentModelIndex> const&, QAbstractItemModel::LayoutChangeHint) () from /usr/lib64/libQt5Core.so.5
#21 0x00007fc8976af787 in QSortFilterProxyModelPrivate::_q_sourceDataChanged(QModelIndex const&, QModelIndex const&, QVector<int> const&) () from /usr/lib64/libQt5Core.so.5
#22 0x00007fc8976b0660 in QSortFilterProxyModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib64/libQt5Core.so.5
#23 0x00007fc8976fed78 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#24 0x00007fc89776bfbc in QAbstractItemModel::dataChanged(QModelIndex const&, QModelIndex const&, QVector<int> const&) () from /usr/lib64/libQt5Core.so.5
#25 0x00007fc7dad4cdef in QPulseAudio::AbstractModel::propertyChanged() () from /usr/lib64/libQPulseAudioPrivate.so
#26 0x00007fc7dad5d1cb in QPulseAudio::AbstractModel::qt_metacall(QMetaObject::Call, int, void**) () from /usr/lib64/libQPulseAudioPrivate.so
#27 0x00007fc8976feee0 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#28 0x00007fc7dad53d82 in void QPulseAudio::PulseObject::updatePulseObject<pa_sink_input_info const>(pa_sink_input_info const*) () from /usr/lib64/libQPulseAudioPrivate.so
#29 0x00007fc7dad52c29 in QPulseAudio::SinkInput::update(pa_sink_input_info const*) () from /usr/lib64/libQPulseAudioPrivate.so
#30 0x00007fc7dad46884 in QPulseAudio::Context::sinkInputCallback(pa_sink_input_info const*) () from /usr/lib64/libQPulseAudioPrivate.so
#31 0x00007fc88c018d85 in context_get_sink_input_info_callback () from /usr/lib64/libpulse.so.0
#32 0x00007fc88b99c231 in run_action () from /usr/lib64/pulseaudio/libpulsecommon-8.0.so
#33 0x00007fc88b99c5a8 in pa_pdispatch_run () from /usr/lib64/pulseaudio/libpulsecommon-8.0.so
#34 0x00007fc88c00ea86 in pstream_packet_callback () from /usr/lib64/libpulse.so.0
#35 0x00007fc88b99ed5f in do_read () from /usr/lib64/pulseaudio/libpulsecommon-8.0.so
#36 0x00007fc88b9a129b in do_pstream_read_write () from /usr/lib64/pulseaudio/libpulsecommon-8.0.so
#37 0x00007fc88b9a1628 in srb_callback () from /usr/lib64/pulseaudio/libpulsecommon-8.0.so
#38 0x00007fc88b9a1e7a in srbchannel_rwloop () from /usr/lib64/pulseaudio/libpulsecommon-8.0.so
#39 0x00007fc88bdf7fa3 in dispatch_func () from /usr/lib64/libpulse-mainloop-glib.so.0
#40 0x00007fc893fa6f9e in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#41 0x00007fc893fa7200 in g_main_context_iterate.isra () from /usr/lib64/libglib-2.0.so.0
#42 0x00007fc893fa72ac in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#43 0x00007fc897724f47 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#44 0x00007fc8976d707a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#45 0x00007fc8976de994 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#46 0x000000000041c5a5 in main ()

Reported using DrKonqi
Comment 1 Christoph Feck 2016-06-13 16:39:27 UTC
Related to bug 342763.
Comment 2 David Edmundson 2016-10-20 23:17:06 UTC

*** This bug has been marked as a duplicate of bug 371215 ***
Comment 3 David Edmundson 2016-10-21 13:49:27 UTC
Git commit f143312e3bb427fe3a31ae1095db4410656b749e by David Edmundson.
Committed on 21/10/2016 at 13:49.
Pushed by davidedmundson into branch 'Plasma/5.8'.

Fix crash in application shutdown (alternate fix)

Summary:

We have a SourceModel that inherits from AbastractModel
AbastractModel inherits from both QObject and Ref.

When we call the destructor of Ref, that kills the
Pulseaudio::context that emits that the default source has changed
during it's teardown.

Because the QObject destructor hasn't run yet, our signals are still
attached; however they refer to data from SourceModel which we've
already run the destructor on - hence crash.

This patch does the ref counting in an alternate way, destroying
the PA Context after our model has disconnected all the
signals, like it would be if the context was a child of the model.

Test Plan:
ran  kquitapp5 plasmashell a lot, everything still seems fine.

I couldn't recreate the original crash, it requires
multiple outputs being deleted in the wrong order, which I
don't happen to have.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D3124

M  +0    -1    src/CMakeLists.txt
M  +12   -0    src/pulseaudio.cpp
M  +3    -2    src/pulseaudio.h
D  +0    -46   src/ref.cpp
D  +0    -54   src/ref.h

http://commits.kde.org/plasma-pa/f143312e3bb427fe3a31ae1095db4410656b749e
Comment 4 David Edmundson 2016-11-20 12:00:15 UTC
*** Bug 372617 has been marked as a duplicate of this bug. ***