Review Request 123770: Play the login sound in its own thread

Andreas Hartmetz ahartmetz at gmail.com
Sat May 16 17:13:37 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/123770/#review80468
-----------------------------------------------------------


Sorry, this has a major flaw: KNotification may pop up a window which is clearly not what you want as a login "sound". Worse, this window is created from a secondary thread which will cause an assertion to fail and kill ksmserver, preventing session startup.
You have to be REALLY careful with multi-threading in Qt and especially KDE applications if you do anything but number crunching in a non-GUI thread.
(I think I have disabled all sounds or something because I don't like system sounds)
Here is the backtrace:


root at rechenplan:/cores# gdb /opt/kde5/bin/kdeinit5 core.NotificationThr.9529 
GNU gdb (Ubuntu 7.9-1ubuntu1) 7.9
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/kde5/bin/kdeinit5...done.

warning: core file may not match specified executable file.
[New LWP 9681]
[New LWP 9533]
[New LWP 9532]
[New LWP 9529]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `ksmserver [kdeinit5]                                       '.
Program terminated with signal SIGABRT, Aborted.
#0  0x00007f1259dfa267 in __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:55
55      ../sysdeps/unix/sysv/linux/raise.c: Datei oder Verzeichnis nicht gefunden.
(gdb) thread apply all bt

Thread 4 (Thread 0x7f125af63780 (LWP 9529)):
#0  0x00007f1259ec08dd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f125736eebc in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f125736efcc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f125a46bcec in QEventDispatcherGlib::processEvents (this=0x953c90, flags=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:418
#4  0x00007f124c2ed242 in QPAEventDispatcherGlib::processEvents (this=<optimized out>, flags=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/platformsupport/eventdispatchers/qeventdispatcher_glib.cpp:115
#5  0x00007f125a4143b0 in QEventLoop::processEvents (this=this at entry=0x7fffd24ff0f0, flags=..., flags at entry=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qeventloop.cpp:128
#6  0x00007f125a4147bd in QEventLoop::exec (this=this at entry=0x7fffd24ff0f0, flags=..., flags at entry=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qeventloop.cpp:204
#7  0x00007f125a41c17a in QCoreApplication::exec () at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qcoreapplication.cpp:1188
#8  0x00007f125a756a4a in QGuiApplication::exec () at /opt/src/ksrc5/qt/stable/qtbase/src/gui/kernel/qguiapplication.cpp:1507
#9  0x00007f125914e301 in QApplication::exec () at /opt/src/ksrc5/qt/stable/qtbase/src/widgets/kernel/qapplication.cpp:2956
#10 0x00007f124e338bfe in kdemain (argc=1, argv=<optimized out>)
    at /home/horst/ksrc5/kde/workspace/plasma-workspace/ksmserver/main.cpp:330
#11 0x0000000000407d17 in launch (argc=argc at entry=1, _name=_name at entry=0x8e1ad8 "ksmserver", args=<optimized out>, 
    args at entry=0x8e1ae2 "/home/horst", cwd=cwd at entry=0x8e1ae2 "/home/horst", envc=envc at entry=51, envs=<optimized out>, 
    envs at entry=0x8e1af6 "QML_IMPORT_PATH=/opt/kde5/lib/qml:/opt/kde5/lib64/qml:/opt/kde5/lib/x86_64-linux-gnu/qml:/opt/kde5/qml", 
    reset_env=true, tty=0x8e239e "", avoid_loops=false, startup_id_str=0x8e23a7 "")
    at /home/horst/ksrc5/frameworks/kinit/src/kdeinit/kinit.cpp:741
#12 0x00000000004087ca in handle_launcher_request (sock=sock at entry=5, who=who at entry=0x40bc09 "wrapper")
    at /home/horst/ksrc5/frameworks/kinit/src/kdeinit/kinit.cpp:1180
#13 0x0000000000409127 in handle_requests (waitForPid=waitForPid at entry=0)
    at /home/horst/ksrc5/frameworks/kinit/src/kdeinit/kinit.cpp:1361
#14 0x000000000040ab88 in main (argc=5, argv=<optimized out>) at /home/horst/ksrc5/frameworks/kinit/src/kdeinit/kinit.cpp:1860

Thread 3 (Thread 0x7f124a6d7700 (LWP 9532)):
#0  0x00007f1259ec08dd in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f12598a0b72 in poll (__timeout=-1, __nfds=1, __fds=0x7f124a6d6d50) at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
#2  _xcb_conn_wait (c=c at entry=0x921ba0, cond=cond at entry=0x921be0, vector=vector at entry=0x0, count=count at entry=0x0)
    at ../../src/xcb_conn.c:447
#3  0x00007f12598a264f in xcb_wait_for_event (c=0x921ba0) at ../../src/xcb_in.c:622
#4  0x00007f124c2bfa31 in QXcbEventReader::run (this=0x92fff0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/plugins/platforms/xcb/qxcbconnection.cpp:1105
#5  0x00007f125a231643 in QThreadPrivate::start (arg=0x92fff0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/thread/qthread_unix.cpp:337
#6  0x00007f12589c66aa in start_thread (arg=0x7f124a6d7700) at pthread_create.c:333
#7  0x00007f1259ecbeed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f12499e3700 (LWP 9533)):
#0  0x00007f1259ec2743 in select () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f125a3be87a in QProcessManager::run (this=0x963650)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/io/qprocess_unix.cpp:264
#2  0x00007f125a231643 in QThreadPrivate::start (arg=0x963650)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/thread/qthread_unix.cpp:337
#3  0x00007f12589c66aa in start_thread (arg=0x7f12499e3700) at pthread_create.c:333
#4  0x00007f1259ecbeed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f1243fff700 (LWP 9681)):
#0  0x00007f1259dfa267 in __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1  0x00007f125b0d5c15 in KCrash::defaultCrashHandler (sig=6) at /home/horst/ksrc5/frameworks/kcrash/src/kcrash.cpp:409
#2  <signal handler called>
#3  0x00007f1259dfa267 in __GI_raise (sig=sig at entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#4  0x00007f1259dfbeca in __GI_abort () at abort.c:89
#5  0x00007f125a21f8f6 in qt_message_fatal (message=..., context=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/global/qlogging.cpp:1422
#6  QMessageLogger::fatal (this=this at entry=0x7f1243ffe530, 
    msg=msg at entry=0x7f125a4b7720 "ASSERT failure in %s: \"%s\", file %s, line %d")
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/global/qlogging.cpp:643
---Type <return> to continue, or q <return> to quit---
#7  0x00007f125a21b078 in qt_assert_x (where=where at entry=0x7f12594f580b "QWidget", 
    what=what at entry=0x7f12594ea5f8 "Widgets must be created in the GUI thread.", 
    file=file at entry=0x7f12594e9b30 "/opt/src/ksrc5/qt/stable/qtbase/src/widgets/kernel/qwidget.cpp", line=line at entry=1126)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/global/qglobal.cpp:2876
#8  0x00007f125919cf69 in QWidgetPrivate::init (this=0x7f1238003a20, parentWidget=<optimized out>, parentWidget at entry=0x0, 
    f=f at entry=...) at /opt/src/ksrc5/qt/stable/qtbase/src/widgets/kernel/qwidget.cpp:1125
#9  0x00007f125919d41a in QWidget::QWidget (this=0x7f12380039e0, dd=..., parent=0x0, f=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/widgets/kernel/qwidget.cpp:1026
#10 0x00007f12591afaf3 in QDesktopWidget::QDesktopWidget (this=0x7f12380039e0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/widgets/kernel/qdesktopwidget.cpp:131
#11 0x00007f125914e276 in QApplication::desktop () at /opt/src/ksrc5/qt/stable/qtbase/src/widgets/kernel/qapplication.cpp:2849
#12 0x00007f12526a4e2a in NotifyByPopup::NotifyByPopup (this=0x7f12380038b0, parent=<optimized out>)
    at /home/horst/ksrc5/frameworks/knotifications/src/notifybypopup.cpp:162
#13 0x00007f1252691b9e in KNotificationManager::KNotificationManager (
    this=0x7f12526c7490 <(anonymous namespace)::Q_QGS_s_self::innerFunction()::holder>)
    at /home/horst/ksrc5/frameworks/knotifications/src/knotificationmanager.cpp:72
#14 0x00007f12526925de in KNotificationManagerSingleton (this=<optimized out>)
    at /home/horst/ksrc5/frameworks/knotifications/src/knotificationmanager.cpp:53
#15 Holder (this=<optimized out>) at /home/horst/ksrc5/frameworks/knotifications/src/knotificationmanager.cpp:59
#16 innerFunction () at /home/horst/ksrc5/frameworks/knotifications/src/knotificationmanager.cpp:59
#17 operator() (this=<optimized out>) at /opt/kde5/include/QtCore/qglobalstatic.h:129
#18 KNotificationManager::self () at /home/horst/ksrc5/frameworks/knotifications/src/knotificationmanager.cpp:63
#19 0x00007f125268eee4 in KNotification::sendEvent (this=0x7f12380013a0)
    at /home/horst/ksrc5/frameworks/knotifications/src/knotification.cpp:397
#20 0x00007f12526b2101 in KNotification::qt_static_metacall (_o=<optimized out>, _c=<optimized out>, _id=<optimized out>, 
    _a=<optimized out>) at src/moc_knotification.cpp:130
#21 0x00007f125a441487 in QMetaCallEvent::placeMetaCall (this=0x7f1238003460, object=0x7f12380013a0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qobject.cpp:485
#22 0x00007f125a4425c4 in QObject::event (this=0x7f12380013a0, e=<optimized out>)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qobject.cpp:1245
#23 0x00007f1259152778 in QApplicationPrivate::notify_helper (this=this at entry=0x913330, receiver=receiver at entry=0x7f12380013a0, 
    e=e at entry=0x7f1238003460) at /opt/src/ksrc5/qt/stable/qtbase/src/widgets/kernel/qapplication.cpp:3720
#24 0x00007f1259157bb6 in QApplication::notify (this=0x913280, receiver=0x7f12380013a0, e=0x7f1238003460)
    at /opt/src/ksrc5/qt/stable/qtbase/src/widgets/kernel/qapplication.cpp:3164
#25 0x00007f125a41538d in QCoreApplication::notifyInternal (this=0x913280, receiver=receiver at entry=0x7f12380013a0, 
    event=event at entry=0x7f1238003460) at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qcoreapplication.cpp:935
#26 0x00007f125a419014 in sendEvent (event=0x7f1238003460, receiver=0x7f12380013a0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qcoreapplication.h:228
#27 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver at entry=0x0, event_type=event_type at entry=0, data=0x991fe0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qcoreapplication.cpp:1552
#28 0x00007f125a4194c4 in QCoreApplication::sendPostedEvents (receiver=receiver at entry=0x0, event_type=event_type at entry=0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qcoreapplication.cpp:1410
#29 0x00007f125a46bbd2 in postEventSourceDispatch (s=0x7f12380012d0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:271
#30 0x00007f125736ec3d in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007f125736ef20 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007f125736efcc in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007f125a46bcec in QEventDispatcherGlib::processEvents (this=0x7f12380008c0, flags=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qeventdispatcher_glib.cpp:418
#34 0x00007f125a4143b0 in QEventLoop::processEvents (this=this at entry=0x7f1243ffedc0, flags=..., flags at entry=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qeventloop.cpp:128
#35 0x00007f125a4147bd in QEventLoop::exec (this=this at entry=0x7f1243ffedc0, flags=..., flags at entry=...)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/kernel/qeventloop.cpp:204
#36 0x00007f125a22c47c in QThread::exec (this=this at entry=0x9910b0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/thread/qthread.cpp:503
#37 0x00007f124e34a60f in NotificationThread::run (this=0x9910b0)
    at /home/horst/ksrc5/kde/workspace/plasma-workspace/ksmserver/startup.cpp:99
#38 0x00007f125a231643 in QThreadPrivate::start (arg=0x9910b0)
    at /opt/src/ksrc5/qt/stable/qtbase/src/corelib/thread/qthread_unix.cpp:337
#39 0x00007f12589c66aa in start_thread (arg=0x7f1243fff700) at pthread_create.c:333
#40 0x00007f1259ecbeed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

- Andreas Hartmetz


On May 14, 2015, 6:03 p.m., Martin Klapetek wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/123770/
> -----------------------------------------------------------
> 
> (Updated May 14, 2015, 6:03 p.m.)
> 
> 
> Review request for Plasma.
> 
> 
> Repository: plasma-workspace
> 
> 
> Description
> -------
> 
> This feature was reverted back in the days as somehow it was blocking with PulseAudio startup which delayed the startup sequence quite considerably. This moves the sound playing into its own thread, which should prevent the blocking.
> 
> 
> Diffs
> -----
> 
>   ksmserver/startup.cpp 4155347 
> 
> Diff: https://git.reviewboard.kde.org/r/123770/diff/
> 
> 
> Testing
> -------
> 
> I was never able to reproduce the blocking, so I'm not sure if this actually fixes the problem.
> 
> 
> Thanks,
> 
> Martin Klapetek
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20150516/5352ae13/attachment-0001.html>


More information about the Plasma-devel mailing list