Bug 318451

Summary: Crash in phonon when changing language with kdesu systemsettings [@ streamToByteArray<QHash<QByteArray, QVariant> >]
Product: [Frameworks and Libraries] Phonon Reporter: Richard Llom <richard.llom>
Component: kded module for audio device listingAssignee: Harald Sitter <sitter>
Status: RESOLVED WORKSFORME    
Severity: crash CC: b.buschinski, germano.massullo, martin.sandsmark, myriam, richard.llom
Priority: NOR Keywords: triaged
Version: unspecified   
Target Milestone: ---   
Platform: Chakra   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: New crash information added by DrKonqi

Description Richard Llom 2013-04-16 14:31:25 UTC
Application: kded4 ($Id$)
KDE Platform Version: 4.10.2
Qt Version: 4.8.4
Operating System: Linux 3.7.6-2-CHAKRA x86_64
Distribution: "Chakra Linux"

-- Information about the crash:
- What I was doing when the application crashed:

I was running systemsettings as root (with kdesu) and changed the language. After apply systemsettings crashed.

-- Backtrace:
Application: KDE-Dienst (kdeinit4), signal: Aborted
Using host libthread_db library "/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f5cb09cd780 (LWP 1586))]

Thread 3 (Thread 0x7f5ca6c7c700 (LWP 1666)):
#0  0x00007f5cb28b6191 in g_mutex_unlock () from /usr/lib/libglib-2.0.so.0
#1  0x00007f5cb2879144 in g_main_context_check () from /usr/lib/libglib-2.0.so.0
#2  0x00007f5cb28795e2 in ?? () from /usr/lib/libglib-2.0.so.0
#3  0x00007f5cb2879764 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#4  0x00007f5cb705afb6 in QEventDispatcherGlib::processEvents (this=0x7f5ca00008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#5  0x00007f5cb7027d2f in QEventLoop::processEvents (this=this@entry=0x7f5ca6c7bdc0, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007f5cb7027f88 in QEventLoop::exec (this=0x7f5ca6c7bdc0, flags=...) at kernel/qeventloop.cpp:204
#7  0x00007f5cb6f1c76d in QThread::exec (this=<optimized out>) at thread/qthread.cpp:542
#8  0x00007f5cb7006c33 in QInotifyFileSystemWatcherEngine::run (this=0x931b90) at io/qfilesystemwatcher_inotify.cpp:256
#9  0x00007f5cb6f1f519 in QThreadPrivate::start (arg=0x931b90) at thread/qthread_unix.cpp:338
#10 0x00007f5cb6c8ce0e in start_thread () from /lib/libpthread.so.0
#11 0x00007f5cb597d1dd in clone () from /lib/libc.so.6

Thread 2 (Thread 0x7f5c9bffe700 (LWP 1671)):
#0  0x00007f5cb28b6180 in g_mutex_unlock () from /usr/lib/libglib-2.0.so.0
#1  0x00007f5cb2878f32 in g_main_context_prepare () from /usr/lib/libglib-2.0.so.0
#2  0x00007f5cb287956b in ?? () from /usr/lib/libglib-2.0.so.0
#3  0x00007f5cb2879764 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#4  0x00007f5cb705afb6 in QEventDispatcherGlib::processEvents (this=0x7f5c94000b10, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#5  0x00007f5cb7027d2f in QEventLoop::processEvents (this=this@entry=0x7f5c9bffddc0, flags=...) at kernel/qeventloop.cpp:149
#6  0x00007f5cb7027f88 in QEventLoop::exec (this=0x7f5c9bffddc0, flags=...) at kernel/qeventloop.cpp:204
#7  0x00007f5cb6f1c76d in QThread::exec (this=<optimized out>) at thread/qthread.cpp:542
#8  0x00007f5cb7006c33 in QInotifyFileSystemWatcherEngine::run (this=0x9618e0) at io/qfilesystemwatcher_inotify.cpp:256
#9  0x00007f5cb6f1f519 in QThreadPrivate::start (arg=0x9618e0) at thread/qthread_unix.cpp:338
#10 0x00007f5cb6c8ce0e in start_thread () from /lib/libpthread.so.0
#11 0x00007f5cb597d1dd in clone () from /lib/libc.so.6

Thread 1 (Thread 0x7f5cb09cd780 (LWP 1586)):
[KCrash Handler]
#6  0x00007f5cb58cdc45 in raise () from /lib/libc.so.6
#7  0x00007f5cb58cf0c8 in abort () from /lib/libc.so.6
#8  0x00007f5cb6f14dff in qt_message_output (msgType=msgType@entry=QtFatalMsg, buf=<optimized out>) at global/qglobal.cpp:2323
#9  0x00007f5cb6f14f78 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=msgType@entry=QtFatalMsg, msg=0x7f5cb70941e8 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=ap@entry=0x7fff80b77088) at global/qglobal.cpp:2369
#10 0x00007f5cb6f15104 in qFatal (msg=<optimized out>) at global/qglobal.cpp:2552
#11 0x00007f5cb704eb74 in QVariant::save (this=0xa24dd8, s=...) at kernel/qvariant.cpp:2049
#12 0x00007f5cb704ec9f in operator<< (s=..., p=...) at kernel/qvariant.cpp:2076
#13 0x00007f5ca6f7f76b in operator<< <QByteArray, QVariant> (out=..., hash=...) at /usr/include/QtCore/qdatastream.h:383
#14 0x00007f5ca6f78154 in streamToByteArray<QHash<QByteArray, QVariant> > (data=...) at /chakra/desktop-testing/kde-runtime/src/kde-runtime-4.10.2/phonon/kded-module/phononserver.cpp:956
#15 PhononServer::updateDevicesCache (this=0x9488c0) at /chakra/desktop-testing/kde-runtime/src/kde-runtime-4.10.2/phonon/kded-module/phononserver.cpp:1017
#16 0x00007f5ca6f78ddb in PhononServer::audioDevicesIndexes (this=<optimized out>, type=<optimized out>) at /chakra/desktop-testing/kde-runtime/src/kde-runtime-4.10.2/phonon/kded-module/phononserver.cpp:823
#17 0x00007f5ca6f74728 in qt_static_metacall (_a=<optimized out>, _id=<optimized out>, _o=<optimized out>, _c=<optimized out>) at /chakra/desktop-testing/kde-runtime/src/kde-runtime-4.10.2/build/phonon/kded-module/moc_phononserver.cpp:75
#18 PhononServer::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, _a=<optimized out>) at /chakra/desktop-testing/kde-runtime/src/kde-runtime-4.10.2/build/phonon/kded-module/moc_phononserver.cpp:69
#19 0x00007f5ca6f748eb in PhononServer::qt_metacall (this=0x9488c0, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0x7fff80b77600) at /chakra/desktop-testing/kde-runtime/src/kde-runtime-4.10.2/build/phonon/kded-module/moc_phononserver.cpp:131
#20 0x00007f5cb3cc6664 in QDBusConnectionPrivate::deliverCall (this=this@entry=0x708fa0, object=object@entry=0x9488c0, msg=..., metaTypes=..., slotIdx=8) at qdbusintegrator.cpp:951
#21 0x00007f5cb3cc7927 in QDBusConnectionPrivate::activateCall (this=this@entry=0x708fa0, object=0x9488c0, flags=241, msg=...) at qdbusintegrator.cpp:856
#22 0x00007f5cb3cc80a7 in QDBusConnectionPrivate::activateObject (this=0x708fa0, node=..., msg=..., pathStartPos=<optimized out>) at qdbusintegrator.cpp:1447
#23 0x00007f5cb3cc848b in QDBusActivateObjectEvent::placeMetaCall (this=0x9323c0) at qdbusintegrator.cpp:1541
#24 0x00007f5cb704036e in QObject::event (this=0x9488c0, e=<optimized out>) at kernel/qobject.cpp:1194
#25 0x00007f5cb6109021 in QApplicationPrivate::notify_helper (this=this@entry=0x730ff0, receiver=receiver@entry=0x9488c0, e=e@entry=0x9323c0) at kernel/qapplication.cpp:4562
#26 0x00007f5cb610e0f9 in QApplication::notify (this=0x7fff80b783f0, receiver=0x9488c0, e=0x9323c0) at kernel/qapplication.cpp:4423
#27 0x00007f5cb7de46e6 in KApplication::notify (this=0x7fff80b783f0, receiver=0x9488c0, event=0x9323c0) at /chakra/desktop-testing/kdelibs/src/kdelibs-4.10.2/kdeui/kernel/kapplication.cpp:311
#28 0x00007f5cb70297ee in QCoreApplication::notifyInternal (this=0x7fff80b783f0, receiver=receiver@entry=0x9488c0, event=event@entry=0x9323c0) at kernel/qcoreapplication.cpp:946
#29 0x00007f5cb702d198 in sendEvent (event=0x9323c0, receiver=0x9488c0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#30 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x69c2b0) at kernel/qcoreapplication.cpp:1570
#31 0x00007f5cb705ae03 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#32 postEventSourceDispatch (s=0x732010) at kernel/qeventdispatcher_glib.cpp:279
#33 0x00007f5cb2879375 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#34 0x00007f5cb28796a8 in ?? () from /usr/lib/libglib-2.0.so.0
#35 0x00007f5cb2879764 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#36 0x00007f5cb705af96 in QEventDispatcherGlib::processEvents (this=0x69e7d0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#37 0x00007f5cb61b654e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#38 0x00007f5cb7027d2f in QEventLoop::processEvents (this=this@entry=0x7fff80b78170, flags=...) at kernel/qeventloop.cpp:149
#39 0x00007f5cb7027f88 in QEventLoop::exec (this=0x7fff80b78170, flags=...) at kernel/qeventloop.cpp:204
#40 0x00007f5cb702d5a8 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#41 0x00007f5cae49f2e0 in kdemain (argc=1, argv=0x704f00) at /chakra/desktop-testing/kdelibs/src/kdelibs-4.10.2/kded/kded.cpp:924
#42 0x0000000000407fdb in launch (argc=argc@entry=1, _name=_name@entry=0x40a8f3 "kded4", args=args@entry=0x0, cwd=cwd@entry=0x0, envc=envc@entry=0, envs=<optimized out>, envs@entry=0x0, reset_env=reset_env@entry=false, tty=tty@entry=0x0, avoid_loops=avoid_loops@entry=false, startup_id_str=startup_id_str@entry=0x40a782 "0") at /chakra/desktop-testing/kdelibs/src/kdelibs-4.10.2/kinit/kinit.cpp:726
#43 0x000000000040575a in main (argc=2, argv=<optimized out>, envp=0x7fff80b78dc0) at /chakra/desktop-testing/kdelibs/src/kdelibs-4.10.2/kinit/kinit.cpp:1841

Reported using DrKonqi
Comment 1 Myriam Schweingruber 2013-04-16 22:23:02 UTC
Is this crash reproducible?
Comment 2 Martin Sandsmark 2013-04-17 08:03:18 UTC
very weird crash, seems like our custom data type isn't registered with Qt before we try to save it. Yet another race condition in the kded module, maybe.
Comment 3 Richard Llom 2013-04-17 08:43:45 UTC
Created attachment 78981 [details]
New crash information added by DrKonqi

kded4 ($Id$) on KDE Platform 4.10.2 using Qt 4.8.4

- What I was doing when the application crashed:

Yes, I can reproduce this.
Although a little correction:
First time systemsettings actually did not crash, but was just in an endless loop "Updating Settings..." (or such a like), I could cancel it and everything went along.
This time there was no error at all in systemsettings.

I can try to do a valgrind trace if needed.

-- Backtrace (Reduced):
#11 0x00007ff34e7c8b74 in QVariant::save (this=0x18d7f58, s=...) at kernel/qvariant.cpp:2049
#12 0x00007ff34e7c8c9f in operator<< (s=..., p=...) at kernel/qvariant.cpp:2076
#13 0x00007ff33e72f76b in operator<< <QByteArray, QVariant> (out=..., hash=...) at /usr/include/QtCore/qdatastream.h:383
#14 0x00007ff33e728154 in streamToByteArray<QHash<QByteArray, QVariant> > (data=...) at /chakra/desktop-testing/kde-runtime/src/kde-runtime-4.10.2/phonon/kded-module/phononserver.cpp:956
#15 PhononServer::updateDevicesCache (this=0x18259e0) at /chakra/desktop-testing/kde-runtime/src/kde-runtime-4.10.2/phonon/kded-module/phononserver.cpp:1017
Comment 4 Christoph Feck 2013-04-23 12:13:10 UTC
If you can reproduce it, please add exact steps to reproduce with a freshly created user account.
Comment 5 Richard Llom 2013-04-26 16:23:39 UTC
(In reply to comment #4)
> If you can reproduce it, please add exact steps to reproduce with a freshly
> created user account.
Since I'm running with kdesu does the user actually matters? (I think it is always running in root environment).

Anyways, I did (steps to reproduce):
- Create new user
- Login as new user
- Open Krunner enter kdesu systemsettings
- produce a sound, (e.g. change a setting in one modul, hit overview -> query (do you want to save...) with sound comes).
- Sound plays, but dr. konqi opens with already attached backtraces.
- systemsettings is stable.
== end ==

I didn't dare to create a new root, but I checked the roots home for pulse configs/files. There was only one cookie, I renamed and tried again -> still crash.

Also I noticed that this crash happens only once per session, if I want to reproduce it several times I need to restart.
Comment 6 Harald Sitter 2013-07-03 23:20:15 UTC
*** Bug 321758 has been marked as a duplicate of this bug. ***
Comment 7 Harald Sitter 2013-07-03 23:37:27 UTC
Martin suspects a race condition and I kind of agree even though that really really really should not happen.

Which phonon version and distribution are you all using?

I'll also need some additional info as I absolutely cannot reproduce this...
Someone who can reproduce the problem please make sure that phonon and phononserver debug symbols are installed then run kded4 in gdb

> gdb --args kded4 --nofork

and set breakpoints on registerPhononMetaTypes and PhononServer::updateDevicesCache

> b registerPhononMetaTypes
> b PhononServer::updateDevicesCache

then run

> r

and try to trigger the crash, but first both breakpoints should be hit so in gdb do for each breakpoint (note that for the first command you may have to hit enter a couple of times to get the entire output)

> thread apply all bt
> c

once it crashes simply quit

> q

copy your entire terminal backlog into a file and attach it.

alternatively just attach the backtrace and tell me which breakpoint is hit first


Notes for further investigation:

type registration is done by using [1] (phonnnamespace.cpp) which in application cases should always be executed before main. however phononserver is a kded module i.e. plugin, so order may be messed up, weird but possible. There is probalby nothing that can be done if the execution order is wrong other than manually registering the types in phononserver to be on the safe side.

[1] https://qt-project.org/wiki/QtResources#9ffdb95250e26c7a6b468126ac7c75b0
Comment 8 Myriam Schweingruber 2013-07-20 14:15:37 UTC
*** Bug 322618 has been marked as a duplicate of this bug. ***
Comment 9 Germano Massullo 2013-07-20 15:13:43 UTC
(In reply to comment #7)
> Martin suspects a race condition and I kind of agree even though that really
> really really should not happen.
> 
> Which phonon version and distribution are you all using?
> 
phonon-4.6.0-7.fc19.x86_64 on Fedora 19
Comment 10 Andrew Crouthamel 2018-09-24 02:15:47 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 11 Andrew Crouthamel 2018-10-27 03:35:08 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!