Bug 348194

Summary: kactivitymanager sometimes crashes on logout
Product: [Plasma] kactivitymanagerd Reporter: Bhushan Shah <bhush94>
Component: generalAssignee: Ivan Čukić <ivan.cukic>
Status: RESOLVED UPSTREAM    
Severity: crash CC: anakin.cs, arortell, cfeck, cjacker, darkeyenick, davispuh, esigra, fabio.coatti, heiko.becker, hrvoje.senjan, ianseeks, info, jonfr3200, josef64, kamil.kuduk, kde.bugzilla.2012, kde, kdebugs, ken20001, linux, mail, marek.schimara, martin.beckert, mathieu.tarral, n_hand, peter, plasma-bugs, rdieter, s093x6f6, sascha.gaspar, stupor_scurvy343, wbauer1
Priority: NOR    
Version: 5.1.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=358321
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: syslog
kern.log
attachment-3089-0.html

Description Bhushan Shah 2015-05-25 04:30:08 UTC
#0  0x00007fdbd0087511 in QSqlDatabase::close (this=this@entry=0x862b98) at kernel/qsqldatabase.cpp:871
#1  0x00007fdbd0088bf9 in QSqlDatabase::~QSqlDatabase (this=0x862b98, __in_chrg=<optimized out>) at kernel/qsqldatabase.cpp:799
#2  0x00007fdbd008af2d in ~QHashNode (this=<optimized out>, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qhash.h:237
#3  QHash<QString, QSqlDatabase>::deleteNode2 (node=0x862b80) at ../../include/QtCore/../../src/corelib/tools/qhash.h:585
#4  0x00007fdbdc660fc9 in QHashData::free_helper (this=0x8f17a0, node_delete=0x7fdbd008af20 <QHash<QString, QSqlDatabase>::deleteNode2(QHashData::Node*)>) at tools/qhash.cpp:491
#5  0x00007fdbd00871e3 in freeData (this=0x7fdbd00b8740 <(anonymous namespace)::Q_QGS_dbDict::innerFunction()::holder>, x=<optimized out>)
    at ../../include/QtCore/../../src/corelib/tools/qhash.h:621
#6  ~QHash (this=0x7fdbd00b8740 <(anonymous namespace)::Q_QGS_dbDict::innerFunction()::holder>, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qhash.h:342
#7  ~QConnectionDict (this=0x7fdbd00b8740 <(anonymous namespace)::Q_QGS_dbDict::innerFunction()::holder>, __in_chrg=<optimized out>) at kernel/qsqldatabase.cpp:110
#8  (anonymous namespace)::Q_QGS_dbDict::Holder::~Holder (this=0x7fdbd00b8740 <(anonymous namespace)::Q_QGS_dbDict::innerFunction()::holder>, __in_chrg=<optimized out>)
    at kernel/qsqldatabase.cpp:126
#9  0x00007fdbd00871e3 in operator() (this=<synthetic pointer>) from /usr/lib/libQt5Sql.so.5
#10 QSqlDatabase::contains (connectionName=...) at kernel/qsqldatabase.cpp:627
#11 0x00007fdbdbe70e78 in __run_exit_handlers () from /usr/lib/libc.so.6
#12 0x00007fdbdbe70ec5 in exit () from /usr/lib/libc.so.6
#13 0x00007fdbd4528367 in QXcbConnection::processXcbEvents (this=<optimized out>) at qxcbconnection.cpp:1376
#14 0x00007fdbdc7eb5d1 in QObject::event (this=0x8202f0, e=<optimized out>) at kernel/qobject.cpp:1246
#15 0x00007fdbdc7bd06e in QCoreApplication::notify (this=<optimized out>, receiver=0x8202f0, event=0x7fdbcc003b30) at kernel/qcoreapplication.cpp:1027
#16 0x00007fdbdc7bcced in QCoreApplication::notifyInternal (this=0x7ffd262888f0, receiver=0x8202f0, event=event@entry=0x7fdbcc003b30) at kernel/qcoreapplication.cpp:965
#17 0x00007fdbdc7c01d2 in sendEvent (event=0x7fdbcc003b30, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:224
#18 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x815f30) at kernel/qcoreapplication.cpp:1582
#19 0x00007fdbdc7c0618 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1440
#20 0x00007fdbdc811943 in postEventSourceDispatch (s=0x85a2a0) at kernel/qeventdispatcher_glib.cpp:271
#21 0x00007fdbd8c6f9fd in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#22 0x00007fdbd8c6fce0 in ?? () from /usr/lib/libglib-2.0.so.0
#23 0x00007fdbd8c6fd8c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#24 0x00007fdbdc8119bf in QEventDispatcherGlib::processEvents (this=0x85bdb0, flags=...) at kernel/qeventdispatcher_glib.cpp:418
#25 0x00007fdbdc7bb68a in QEventLoop::exec (this=this@entry=0x7ffd262887a0, flags=..., flags@entry=...) at kernel/qeventloop.cpp:204
#26 0x00007fdbdc7c35fc in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#27 0x00007fdbdcafc85c in QGuiApplication::exec () at kernel/qguiapplication.cpp:1528
#28 0x0000000000412c2f in main (argc=2, argv=<optimized out>) at /home/bshah/src/frameworks/kactivities-git/src/kactivities/src/service/Application.cpp:414


Reproducible: Sometimes




I have the core file of crash with me if needed.
Comment 1 Martin Beckert 2015-05-30 12:59:00 UTC
Created attachment 92924 [details]
syslog

syslog
Comment 2 Martin Beckert 2015-05-30 13:00:02 UTC
Created attachment 92925 [details]
kern.log

kern.log
Comment 3 Martin Beckert 2015-05-30 13:00:14 UTC
Yes, this bug also exists when starting Libreoffice Writer. So when starting Writer the KDE desktop crashes and I fall back to login screen. Maybe there is also another bug?
Comment 4 Ivan Čukić 2015-05-30 14:09:12 UTC
kactivitymanagerd can not crash the X11 session. 

Does the crash persist on kactivities 5.3?
Comment 5 Martin Beckert 2015-05-30 14:32:14 UTC
Hmm... I'm using Kubuntu 15.04 with kubuntu-ppa (http://www.kubuntu.org/news/plasma-5.3). Hardware is AMD A10-7300 (Acer E5-551G). No other ppa, so driver and kernel is ubuntu vanilla. Do you need any other information? Maybe some other log when starting libreoffice writer?

Thx!
Comment 6 Ivan Čukić 2015-05-30 16:31:55 UTC
For the kamd crash, I don't need anything more.

Session crash is not a part of this issue. Essentially, if you session crashes, it is 99% a fault of the graphics driver (some application invoking a buggy part of the driver) - that is not something I can help you with. You could try switching between the free driver and the proprietary one.
Comment 7 Dāvis 2015-07-16 21:27:47 UTC
I've same crash, happening with everything latest compiled from git (Qt 5.5, KF5, etc). Any idea? It might be Qt bug...

#0  0x00007f5ea60cc8a1 in QSqlDatabase::close (this=this@entry=0x1f32d78) at kernel/qsqldatabase.cpp:871
#1  0x00007f5ea60cdf11 in QSqlDatabase::~QSqlDatabase (this=0x1f32d78, __in_chrg=<optimized out>) at kernel/qsqldatabase.cpp:799
#2  0x00007f5ea60d018d in ~QHashNode (this=<optimized out>, __in_chrg=<optimized out>)
    at ../../include/QtCore/../../src/corelib/tools/qhash.h:237
#3  QHash<QString, QSqlDatabase>::deleteNode2 (node=0x1f32d60) at ../../include/QtCore/../../src/corelib/tools/qhash.h:585
#4  0x00007f5ec2a69de9 in QHashData::free_helper (this=0x1f38870, 
    node_delete=0x7f5ea60d0180 <QHash<QString, QSqlDatabase>::deleteNode2(QHashData::Node*)>) at tools/qhash.cpp:491
#5  0x00007f5ea60cc573 in freeData (this=0x7f5ea62fc660 <(anonymous namespace)::Q_QGS_dbDict::innerFunction()::holder>, 
    x=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qhash.h:621
#6  ~QHash (this=0x7f5ea62fc660 <(anonymous namespace)::Q_QGS_dbDict::innerFunction()::holder>, __in_chrg=<optimized out>)
    at ../../include/QtCore/../../src/corelib/tools/qhash.h:342
#7  ~QConnectionDict (this=0x7f5ea62fc660 <(anonymous namespace)::Q_QGS_dbDict::innerFunction()::holder>, 
    __in_chrg=<optimized out>) at kernel/qsqldatabase.cpp:110
#8  (anonymous namespace)::Q_QGS_dbDict::Holder::~Holder (
    this=0x7f5ea62fc660 <(anonymous namespace)::Q_QGS_dbDict::innerFunction()::holder>, __in_chrg=<optimized out>)
    at kernel/qsqldatabase.cpp:126
#9  0x00007f5ea60cc573 in operator() (this=<synthetic pointer>) from /usr/lib/libQt5Sql.so.5
#10 QSqlDatabase::contains (connectionName=...) at kernel/qsqldatabase.cpp:627
#11 0x00007f5ec2275e78 in __run_exit_handlers () from /usr/lib/libc.so.6
#12 0x00007f5ec2275ec5 in exit () from /usr/lib/libc.so.6
#13 0x00007f5eb77de4bf in QXcbConnection::processXcbEvents (this=<optimized out>) at qxcbconnection.cpp:1419
#14 0x00007f5ec2bf0ae1 in QObject::event (this=0x1e4c9f0, e=<optimized out>) at kernel/qobject.cpp:1239
#15 0x00007f5ec2bc2d4e in QCoreApplication::notify (this=<optimized out>, receiver=0x1e4c9f0, event=0x7f5eb00075c0)
    at kernel/qcoreapplication.cpp:1038
#16 0x00007f5ec2bc29dc in QCoreApplication::notifyInternal (this=0x7ffe53c45900, receiver=0x1e4c9f0, 
    event=event@entry=0x7f5eb00075c0) at kernel/qcoreapplication.cpp:965
#17 0x00007f5ec2bc5dea in sendEvent (event=0x7f5eb00075c0, receiver=<optimized out>)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:224
#18 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x1e3f400)
    at kernel/qcoreapplication.cpp:1593
#19 0x00007f5ec2bc6230 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0)
    at kernel/qcoreapplication.cpp:1451
#20 0x00007f5ec2c15f63 in postEventSourceDispatch (s=0x1e9f620) at kernel/qeventdispatcher_glib.cpp:271
#21 0x00007f5ebeb499fd in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#22 0x00007f5ebeb49ce0 in ?? () from /usr/lib/libglib-2.0.so.0
#23 0x00007f5ebeb49d8c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#24 0x00007f5ec2c15ffb in QEventDispatcherGlib::processEvents (this=0x1e95250, flags=...) at kernel/qeventdispatcher_glib.cpp:420
#25 0x00007f5ec2bc139a in QEventLoop::exec (this=this@entry=0x7ffe53c457b0, flags=..., flags@entry=...)
    at kernel/qeventloop.cpp:204
#26 0x00007f5ec2bc923c in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1229
#27 0x00007f5ec30fcbf4 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1528
#28 0x0000000000412c4a in main (argc=2, argv=<optimized out>)
    at /mnt/AUR/kactivities-git/src/kactivities/src/service/Application.cpp:414


Dump of assembler code for function QSqlDatabase::close():
870     {

871         d->driver->close();
   0x00007f5ea60cc890 <+0>:     mov    rax,QWORD PTR [rdi]
   0x00007f5ea60cc893 <+3>:     lea    rdx,[rip+0xfffffffffffff8a6]        # 0x7f5ea60cc140 <QSqlNullDriver::close()>
   0x00007f5ea60cc89a <+10>:    mov    rdi,QWORD PTR [rax+0x10]
   0x00007f5ea60cc89e <+14>:    mov    rax,QWORD PTR [rdi]
=> 0x00007f5ea60cc8a1 <+17>:    mov    rax,QWORD PTR [rax+0xc0]
   0x00007f5ea60cc8a8 <+24>:    cmp    rax,rdx
   0x00007f5ea60cc8ab <+27>:    jne    0x7f5ea60cc8b0 <QSqlDatabase::close()+32>
   0x00007f5ea60cc8ad <+29>:    ret
   0x00007f5ea60cc8ae <+30>:    xchg   ax,ax
   0x00007f5ea60cc8b0 <+32>:    jmp    rax
   0x00007f5ea60cc8b2:  nop    WORD PTR [rax+rax*1+0x0]

End of assembler dump.
(gdb) p *$rax
Cannot access memory at address 0x7f5ea5e7dc50

It looks like memory was freed before close()
Comment 8 Kevin Funk 2015-07-20 19:23:21 UTC
*** Bug 350422 has been marked as a duplicate of this bug. ***
Comment 9 Kevin Funk 2015-07-20 19:24:20 UTC
Sounds related to https://bugreports.qt.io/browse/QTBUG-35977
Comment 10 Cjacker 2015-07-21 12:08:03 UTC
seems a qt bug.

A temp workaround is invoking 'kactivitymanaged stop' in 'startkde' script to avoid coredump when kde shutdown.
Comment 11 Adam ortell 2015-07-22 19:55:36 UTC
Created attachment 93703 [details]
attachment-3089-0.html

Thanks that worked

On Tue, Jul 21, 2015 at 7:08 AM, Cjacker <cjacker@gmail.com> wrote:

> https://bugs.kde.org/show_bug.cgi?id=348194
>
> Cjacker <cjacker@gmail.com> changed:
>
>            What    |Removed                     |Added
>
> ----------------------------------------------------------------------------
>                  CC|                            |cjacker@gmail.com
>
> --- Comment #10 from Cjacker <cjacker@gmail.com> ---
> seems a qt bug.
>
> A temp workaround is invoking 'kactivitymanaged stop' in 'startkde' script
> to
> avoid coredump when kde shutdown.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 12 Peter Wu 2015-08-01 12:09:51 UTC
This can be marked as confirmed, it crashes 100% of the time on logout here (Arch Linux, Qt 5.5.0, kactivities-frameworks 5.12.0).

Definitely a Qt5 bug, see the analysis at
https://bugreports.qt.io/browse/QTBUG-35977?focusedCommentId=287864#comment-287864

Possible workaround is to create a
~/.config/plasma-workspace/shutdown/stop-kactivitymanagerd.sh with:

#!/bin/sh
# https://bugs.kde.org/show_bug.cgi?id=348194
kactivitymanagerd stop
Comment 13 Ivan Čukić 2015-08-15 20:21:03 UTC
*** Bug 351341 has been marked as a duplicate of this bug. ***
Comment 14 Ivan Čukić 2015-08-29 20:20:36 UTC
*** Bug 351985 has been marked as a duplicate of this bug. ***
Comment 15 Eugene 2015-08-29 20:59:36 UTC
I'm experiencing this bug too. Something happens during logon/logoff process:
kactivitymanage[1884]: segfault at 7f1964027cd0 ip 00007f19590b61b1 sp 00007ffd161559a8 error 4 in libQt5Sql.so.5.4.2[7f19590a2000+3f000]
Comment 16 Mathieu Tarral 2015-09-08 11:09:48 UTC
Hi,
i can confirm this bug here, and it happens everytime I'm trying to logout.

Same dmesg log  as above, but with Qt 5.5.0 :

kactivitymanage[1794]: segfault at 7f9ab9b32cf0 ip 00007f9ab9d7a731 sp 00007ffe43baf228 error 4 in libQt5Sql.so.5.5.0[7f9ab9d66000+3f000]
Comment 17 Ivan Čukić 2015-09-19 13:33:12 UTC
*** Bug 352907 has been marked as a duplicate of this bug. ***
Comment 18 Marek 2015-09-21 08:18:38 UTC
I confirm this segfaults at every single logout on Fedora 22 x86_64 / Qt: 4.8.6 / KDE Development Platform: 4.14.9

(gdb) bt
#0  0x00007f5f9a1dd731 in QSqlDatabase::close() (this=this@entry=0x1f8df78) at kernel/qsqldatabase.cpp:871
#1  0x00007f5f9a1dec99 in QSqlDatabase::~QSqlDatabase() (this=0x1f8df78, __in_chrg=<optimized out>) at kernel/qsqldatabase.cpp:799
#2  0x00007f5f9a1e0ccd in QHash<QString, QSqlDatabase>::deleteNode2(QHashData::Node*) (this=<optimized out>, __in_chrg=<optimized out>) at ../../src/corelib/tools/qhash.h:237
#3  0x00007f5f9a1e0ccd in QHash<QString, QSqlDatabase>::deleteNode2(QHashData::Node*) (node=0x1f8df60) at ../../src/corelib/tools/qhash.h:585
...

(gdb) frame 0
#0  0x00007f5f9a1dd731 in QSqlDatabase::close (this=this@entry=0x1f8df78) at kernel/qsqldatabase.cpp:871
871         d->driver->close();
(gdb) p d
$1 = (QSqlDatabasePrivate *) 0x1f807f0
(gdb) p *d
$2 = {ref = {<QAtomicInteger<int>> = {<QBasicAtomicInteger<int>> = {_q_value = 0}, <No data fields>}, <No data fields>}, q = 0x7ffd7855e1e0, driver = 0x1f6f3e0, dbname = {static null = {<No data fields>}, d = 0x1f845d0}, uname = {
    static null = {<No data fields>}, d = 0x7f5fc1680a40 <QArrayData::shared_null>}, pword = {static null = {<No data fields>}, d = 0x7f5fc1680a40 <QArrayData::shared_null>}, hname = {static null = {<No data fields>}, 
    d = 0x7f5fc1680a40 <QArrayData::shared_null>}, drvName = {static null = {<No data fields>}, d = 0x1f84cc0}, port = -1, connOptions = {static null = {<No data fields>}, d = 0x7f5fc1680a40 <QArrayData::shared_null>}, connName = {
    static null = {<No data fields>}, d = 0x1f7c500}, precisionPolicy = QSql::LowPrecisionDouble}
Comment 19 Ivan Čukić 2015-12-15 12:04:40 UTC
*** Bug 356291 has been marked as a duplicate of this bug. ***
Comment 20 Ivan Čukić 2015-12-22 12:07:35 UTC
Git commit 0f44684fb43563565d9926d444a642ca1a5d52ca by Ivan Čukić.
Committed on 22/12/2015 at 12:02.
Pushed by ivan into branch 'master'.

Work-around for the Qt SQL bug that does not clean up connections properly

Qt bug is documented here: https://bugreports.qt.io/browse/QTBUG-35977

M  +100  -52   src/common/database/Database.cpp
M  +32   -1    src/service/Application.cpp

http://commits.kde.org/kactivities/0f44684fb43563565d9926d444a642ca1a5d52ca
Comment 21 Ivan Čukić 2015-12-22 12:08:11 UTC
I'm a bit tired of the qtsql issue popping up everywhere, in reports not related to activities, so I've decided to try to make a work around. It is a bit difficult since I'm not able to reproduce the problem.

But, I'm now trying to clean up Qt sql connections before the application is really stopped.

If someone is able to test the latest master, it would be much appreciated.
Comment 22 Sascha Gaspar 2016-02-01 19:21:14 UTC
On my PC it crashes too. Here are some infos from coredumpctl and dmesg:

           PID: 1867 (kactivitymanage)
           UID: 1000 (sascha)
           GID: 1000 (sascha)
        Signal: 11 (SEGV)
     Timestamp: Mo 2016-01-25 21:19:07 CET (6 days ago)
  Command Line: /usr/bin/kactivitymanagerd start-daemon
    Executable: /usr/bin/kactivitymanagerd
 Control Group: /user.slice/user-1000.slice/session-c1.scope
          Unit: session-c1.scope
         Slice: user-1000.slice
       Session: c1
     Owner UID: 1000 (sascha)
       Boot ID: a507d51b25dd4730a8cae8b8419567c0
    Machine ID: bc95e938d3394a5f904bd1055d2c1ca2
      Hostname: homeserver.sg78.de
       Message: Process 1867 (kactivitymanage) of user 1000 dumped core.
                
                Stack trace of thread 1867:
                #0  0x00007fd644086291 _ZN12QSqlDatabase5closeEv (libQt5Sql.so.5)
                #1  0x00007fd6440877f9 _ZN12QSqlDatabaseD1Ev (libQt5Sql.so.5)
                #2  0x00007fd64408982d n/a (libQt5Sql.so.5)
                #3  0x00007fd65cce5299 _ZN9QHashData11free_helperEPFvPNS_4NodeEE (libQt5Core.so.5)
                #4  0x00007fd644085f63 n/a (libQt5Sql.so.5)
                #5  0x00007fd65c4ebf88 __run_exit_handlers (libc.so.6)
                #6  0x00007fd65c4ebfd5 exit (libc.so.6)
                #7  0x00007fd652e15e4e _ZN14QXcbConnection16processXcbEventsEv (libQt5XcbQpa.so.5)
                #8  0x00007fd65ce921e1 _ZN7QObject5eventEP6QEvent (libQt5Core.so.5)
                #9  0x00007fd65d70d9ac _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent (libQt5Widgets.so.5)
                #10 0x00007fd65d712e86 _ZN12QApplication6notifyEP7QObjectP6QEvent (libQt5Widgets.so.5)
                #11 0x00007fd65ce62bab _ZN16QCoreApplication14notifyInternalEP7QObjectP6QEvent (libQt5Core.so.5)
                #12 0x00007fd65ce64fa6 _ZN23QCoreApplicationPrivate16sendPostedEventsEP7QObjectiP11QThreadData (libQt5Core.so.5)
                #13 0x00007fd65ceb6ac2 _ZN20QEventDispatcherUNIX13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5)
                #14 0x00007fd652e7821d n/a (libQt5XcbQpa.so.5)
                #15 0x00007fd65ce6057a _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5)
                #16 0x00007fd65ce6853c _ZN16QCoreApplication4execEv (libQt5Core.so.5)
                #17 0x0000000000410aa4 main (kactivitymanagerd)
                #18 0x00007fd65c4d6610 __libc_start_main (libc.so.6)
                #19 0x0000000000410c79 _start (kactivitymanagerd)
                
                Stack trace of thread 1884:
                #0  0x00007fd65c597e23 __select (libc.so.6)
                #1  0x00007fd65ceb4c1f _Z14qt_safe_selectiP6fd_setS0_S0_PK8timespec (libQt5Core.so.5)
                #2  0x00007fd65ceb66f7 _ZN27QEventDispatcherUNIXPrivate8doSelectE6QFlagsIN10QEventLoop17ProcessEventsFlagEEP8timespec (libQt5Core.so.5)
                #3  0x00007fd65ceb6bfe _ZN20QEventDispatcherUNIX13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5)
                #4  0x00007fd65ce6057a _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5)
                #5  0x00007fd65cc7cbe4 _ZN7QThread4execEv (libQt5Core.so.5)
                #6  0x0000000000412e0a _ZZ12runInQThreadI8FeaturesEPT_vEN6Thread3runEv (kactivitymanagerd)
                #7  0x00007fd65cc81b8e n/a (libQt5Core.so.5)
                #8  0x00007fd65b5ef4a4 start_thread (libpthread.so.0)
                #9  0x00007fd65c59f13d __clone (libc.so.6)
                
                Stack trace of thread 1883:
                #0  0x00007fd65c597e23 __select (libc.so.6)
                #1  0x00007fd65ceb4c1f _Z14qt_safe_selectiP6fd_setS0_S0_PK8timespec (libQt5Core.so.5)
                #2  0x00007fd65ceb66f7 _ZN27QEventDispatcherUNIXPrivate8doSelectE6QFlagsIN10QEventLoop17ProcessEventsFlagEEP8timespec (libQt5Core.so.5)
                #3  0x00007fd65ceb6bfe _ZN20QEventDispatcherUNIX13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5)
                #4  0x00007fd65ce6057a _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5)
                #5  0x00007fd65cc7cbe4 _ZN7QThread4execEv (libQt5Core.so.5)
                #6  0x0000000000412dda _ZZ12runInQThreadI10ActivitiesEPT_vEN6Thread3runEv (kactivitymanagerd)
                #7  0x00007fd65cc81b8e n/a (libQt5Core.so.5)
                #8  0x00007fd65b5ef4a4 start_thread (libpthread.so.0)
                #9  0x00007fd65c59f13d __clone (libc.so.6)
                
                Stack trace of thread 1881:
                #0  0x00007fd65c597e23 __select (libc.so.6)
                #1  0x00007fd65ceb4c1f _Z14qt_safe_selectiP6fd_setS0_S0_PK8timespec (libQt5Core.so.5)
                #2  0x00007fd65ceb66f7 _ZN27QEventDispatcherUNIXPrivate8doSelectE6QFlagsIN10QEventLoop17ProcessEventsFlagEEP8timespec (libQt5Core.so.5)
                #3  0x00007fd65ceb6bfe _ZN20QEventDispatcherUNIX13processEventsE6QFlagsIN10QEventLoop17ProcessEventsFlagEE (libQt5Core.so.5)
                #4  0x00007fd65ce6057a _ZN10QEventLoop4execE6QFlagsINS_17ProcessEventsFlagEE (libQt5Core.so.5)
                #5  0x00007fd65cc7cbe4 _ZN7QThread4execEv (libQt5Core.so.5)
                #6  0x0000000000412daa _ZZ12runInQThreadI9ResourcesEPT_vEN6Thread3runEv (kactivitymanagerd)
                #7  0x00007fd65cc81b8e n/a (libQt5Core.so.5)
                #8  0x00007fd65b5ef4a4 start_thread (libpthread.so.0)
                #9  0x00007fd65c59f13d __clone (libc.so.6)

           PID: 5738 (kactivitymanage)
           UID: 1000 (sascha)
           GID: 1000 (sascha)
        Signal: 11 (SEGV)
     Timestamp: Mo 2016-01-25 21:19:36 CET (6 days ago)
  Command Line: /usr/bin/kactivitymanagerd start-daemon
    Executable: /usr/bin/kactivitymanagerd
 Control Group: /user.slice/user-1000.slice/session-c1.scope
          Unit: session-c1.scope
         Slice: user-1000.slice
       Session: c1
     Owner UID: 1000 (sascha)
Comment 23 Francis Herne 2016-03-06 19:19:07 UTC
This still occurs with 5.5.95 (5.6-beta). Not on every logout here, about one in three. I have traces and a coredump, but they're pretty much identical to those above.

Does it really need a dozen reports with backtraces for this to be confirmed?
Comment 24 Rex Dieter 2016-03-06 19:55:06 UTC
fine, marking confirmed (doesn't matter much, I think it's safe to acknowledge at this point)
Comment 25 Ivan Čukić 2016-03-06 20:04:17 UTC
@Francis

The difference between not confirmed, but got the response from the maintainer, and was detected to be a known upstream (Qt) bug, and being confirmed is moot.

Anyhow, thanks for testing - this means that I wasn't able to work around the Qt bug. Will see what else can be done.
Comment 26 Ivan Čukić 2016-08-09 08:28:43 UTC
*** Bug 366530 has been marked as a duplicate of this bug. ***
Comment 27 josef64 2016-09-04 17:05:27 UTC
Hello,
I not sure these Info helps.
I use Plasma 5 on Gentoo with:
Qt 5.7.0
kde-frameworks current git master (5.25.0)
kde-plasma current git master (5.7.90)

From dmesg:
[ 2374.378540] kactivitymanage[2187]: segfault at 7f633411dc90 ip 00007f63340c38b1 sp 00007ffd424c2418 error 4 in libQt5Sql.so.5.7.0[7f63340ad000+46000]

I noticed these crashes happens when I update plasma-workspace on a running plasma session, and relogin.
A workaround is, logout and remove
~/.local/share/kactivitymanagerd/resources/database and ~/.local/share/kscreen/*
After that I have no kactivitymanager segfaults more.
Comment 28 Ivan Čukić 2016-09-20 14:25:14 UTC
*** Bug 368754 has been marked as a duplicate of this bug. ***
Comment 29 Ivan Čukić 2016-09-23 16:41:59 UTC
*** Bug 369145 has been marked as a duplicate of this bug. ***
Comment 30 Jón Frímann 2016-09-23 19:34:10 UTC
I'm getting this bug. Running the following in Gentoo Linux.

"x11-drivers/nvidia-drivers-367.44"
"uname -a
Linux jupiter 4.7.4 #1 SMP PREEMPT Fri Sep 23 04:31:06 CEST 2016 x86_64 AMD A6-7400K Radeon R5, 6 Compute Cores 2C+4G AuthenticAMD GNU/Linux"
"x11-base/xorg-server-1.18.4"

This issue only appears after using version nvidia-driver-367.44 (or it happens when switched to the nvidia-driver-367 version), using version 364.18 and this crash does not happen. I'm going to downgrade to latest long-term kernel so I can continue to use nvidia-driver 364 driver so this issue doesn't happen. Using xorg-server-1.18.4 prevents hangs. I don't know why that is.

The last error code I get was this.

"[ 2528.367412] traps: ck-remove-direc[5366] trap int3 ip:7fe4a3173537 sp:7ffe21337230 error:0
[ 2528.372413] kactivitymanage[3669]: segfault at 7f63d8569c50 ip 00007f63d5031071 sp 00007ffda4d749d8 error 4 in libQt5Sql.so.5.6.1[7f63d501c000+42000]
[ 2528.789604] nvidia-modeset: Freed GPU:0 (GPU-c596bde8-99af-0bbf-bfda-49e673acdf90) @ PCI:0000:01:00.0
[ 2529.224775] nvidia-modeset: Allocated GPU:0 (GPU-c596bde8-99af-0bbf-bfda-49e673acdf90) @ PCI:0000:01:00.0
[ 2563.764099] traps: ck-remove-direc[5411] trap int3 ip:7f74433cb537 sp:7ffc01f0ac60 error:0
[ 2597.270142] traps: ck-remove-direc[5684] trap int3 ip:7f53907fb537 sp:7ffd2604e2e0 error:0
[ 2597.685181] nvidia-modeset: Freed GPU:0 (GPU-c596bde8-99af-0bbf-bfda-49e673acdf90) @ PCI:0000:01:00.0
[ 2598.119525] nvidia-modeset: Allocated GPU:0 (GPU-c596bde8-99af-0bbf-bfda-49e673acdf90) @ PCI:0000:01:00.0
[ 2609.796294] traps: ck-remove-direc[5728] trap int3 ip:7f0402273537 sp:7ffc4bedc5f0 error:0"
Comment 31 josef64 2016-09-24 00:05:17 UTC
(In reply to Jón Frímann from comment #30)
> I'm getting this bug. Running the following in Gentoo Linux.
> 
> "x11-drivers/nvidia-drivers-367.44"
> "uname -a
> Linux jupiter 4.7.4 #1 SMP PREEMPT Fri Sep 23 04:31:06 CEST 2016 x86_64 AMD
> A6-7400K Radeon R5, 6 Compute Cores 2C+4G AuthenticAMD GNU/Linux"
> "x11-base/xorg-server-1.18.4"
> 
> This issue only appears after using version nvidia-driver-367.44 (or it
> happens when switched to the nvidia-driver-367 version), using version
> 364.18 and this crash does not happen. I'm going to downgrade to latest
> long-term kernel so I can continue to use nvidia-driver 364 driver so this
> issue doesn't happen. Using xorg-server-1.18.4 prevents hangs. I don't know
> why that is.
> [...]

Sorry no, I can not confirm.
I use the same versions on Gentoo-Linux
# emerge -pvq xorg-server nvidia-drivers
[ebuild   R   ] x11-base/xorg-server-1.18.4  USE="ipv6 suid systemd udev xorg xvfb -dmx -doc -glamor -kdrive -libressl -minimal (-selinux) -static-libs -tslib -unwind -wayland -xephyr -xnest" 
[ebuild   R   ] x11-drivers/nvidia-drivers-367.44  USE="X acpi driver gtk3 kms multilib tools wayland -compat -pax_kernel -static-libs -uvm"
# uname -r
4.7.4-gentoo
and it works works very well.

Try the tip/workaround from  Comment 27
or test it with a fresh clean testuser.
Comment 32 Jón Frímann 2016-09-24 00:25:24 UTC
(In reply to H.d.V. from comment #31)
> (In reply to Jón Frímann from comment #30)
> > I'm getting this bug. Running the following in Gentoo Linux.
> > 
> > "x11-drivers/nvidia-drivers-367.44"
> > "uname -a
> > Linux jupiter 4.7.4 #1 SMP PREEMPT Fri Sep 23 04:31:06 CEST 2016 x86_64 AMD
> > A6-7400K Radeon R5, 6 Compute Cores 2C+4G AuthenticAMD GNU/Linux"
> > "x11-base/xorg-server-1.18.4"
> > 
> > This issue only appears after using version nvidia-driver-367.44 (or it
> > happens when switched to the nvidia-driver-367 version), using version
> > 364.18 and this crash does not happen. I'm going to downgrade to latest
> > long-term kernel so I can continue to use nvidia-driver 364 driver so this
> > issue doesn't happen. Using xorg-server-1.18.4 prevents hangs. I don't know
> > why that is.
> > [...]
> 
> Sorry no, I can not confirm.
> I use the same versions on Gentoo-Linux
> # emerge -pvq xorg-server nvidia-drivers
> [ebuild   R   ] x11-base/xorg-server-1.18.4  USE="ipv6 suid systemd udev
> xorg xvfb -dmx -doc -glamor -kdrive -libressl -minimal (-selinux)
> -static-libs -tslib -unwind -wayland -xephyr -xnest" 
> [ebuild   R   ] x11-drivers/nvidia-drivers-367.44  USE="X acpi driver gtk3
> kms multilib tools wayland -compat -pax_kernel -static-libs -uvm"
> # uname -r
> 4.7.4-gentoo
> and it works works very well.
> 
> Try the tip/workaround from  Comment 27
> or test it with a fresh clean testuser.

I'm currently testing the suggested fix in comment 27. It takes around 24 to 48 hours to see if it works without a problem. This might be a local database corruption problem related to this issue. I just don't know yet. While we might be running the same version of software, there might be difference at deeper level in the system that is difficult to know about. Anything from version of video card (I'm using 01:00.0 VGA compatible controller: NVIDIA Corporation GK208 [GeForce GT 720] (rev a1)) down to some software library that I'm using and has not been updated yet.
Comment 33 Christoph Feck 2016-09-25 01:21:41 UTC
The bug is not in QtSql. The bug is that QXcbConnection::processXcbEvents() calls exit().
Comment 34 Ivan Čukić 2016-09-26 06:39:14 UTC
@Christoph

It is a bug in QtSQL that is triggered by XCB's exit(). See https://bugreports.qt.io/browse/QTBUG-35977 - it is a race between unloading the drivers and closing the connection.
Comment 35 Wolfgang Bauer 2016-09-27 22:22:15 UTC
This should fix it though:
https://codereview.qt-project.org/#/c/140750/

And it fixes bug#359758 as well. ;-)
Comment 36 Ivan Čukić 2016-09-28 12:03:33 UTC
@Wolfgang 

Great! Thanks for sharing the link.

So, we will get the fix in Qt 5.8. (a bit of a problem is that we will have Plasma 5.8 LTS without this patch, but we can not do much about it I'm afraid)

I'm marking this as the upstream issue.
Comment 37 Ivan Čukić 2016-10-13 04:29:54 UTC
*** Bug 370579 has been marked as a duplicate of this bug. ***
Comment 38 Christoph Feck 2017-01-04 19:28:16 UTC
*** Bug 374473 has been marked as a duplicate of this bug. ***
Comment 39 Christoph Feck 2017-09-20 22:55:10 UTC
*** Bug 377524 has been marked as a duplicate of this bug. ***