Bug 332681 - KWin crash
Summary: KWin crash
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kwindowsystem
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Martin Flöser
URL: https://git.reviewboard.kde.org/r/117...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-27 13:02 UTC by Bhushan Shah
Modified: 2014-04-25 07:02 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bhushan Shah 2014-03-27 13:02:21 UTC
I don't know steps to reproduce but here is crash,

Application:  (kwin), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
To enable execution of this file add
	add-auto-load-safe-path /usr/lib/libstdc++.so.6.0.19-gdb.py
line to your configuration file "/home/bshah/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/bshah/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
[Current thread is 1 (Thread 0xb21ea780 (LWP 6675))]

Thread 2 (Thread 0xaefcab40 (LWP 6683)):
#0  0xb7767424 in __kernel_vsyscall ()
#1  0xb4e39322 in clock_gettime () from /usr/lib/libc.so.6
#2  0xb51c297e in ?? () from /usr/lib/libQt5Core.so.5
#3  0xb531f2e1 in QTimerInfoList::updateCurrentTime() () from /usr/lib/libQt5Core.so.5
#4  0xb531f6b6 in QTimerInfoList::timerWait(timespec&) () from /usr/lib/libQt5Core.so.5
#5  0xb531ed46 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#6  0xb52cc3c8 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#7  0xb52cc7ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#8  0xb513250b in QThread::exec() () from /usr/lib/libQt5Core.so.5
#9  0xb6b15d78 in ?? () from /usr/lib/libQt5Qml.so.5
#10 0xb51369da in ?? () from /usr/lib/libQt5Core.so.5
#11 0xb4ce1f20 in start_thread () from /usr/lib/libpthread.so.0
#12 0xb4e2b94e in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0xb21ea780 (LWP 6675)):
[KCrash Handler]
#7  0xb4dbcc04 in __memcmp_ia32 () from /usr/lib/libc.so.6
#8  0xb5138a52 in qstrcmp(QByteArray const&, QByteArray const&) () from /usr/lib/libQt5Core.so.5
#9  0xb5f92208 in operator< (a1=..., a2=...) at /usr/include/qt/QtCore/qbytearray.h:550
#10 0xb5f8ed2d in KStartupInfoId::operator< (this=0x93708c4, id_P=...) at /home/bshah/kdesrc/frameworks/kwindowsystem/src/kstartupinfo.cpp:1211
#11 0xb5f94417 in qMapLessThanKey<KStartupInfoId> (key1=..., key2=...) at /usr/include/qt/QtCore/qmap.h:75
#12 0xb5f94b60 in QMapNode<KStartupInfoId, KStartupInfo::Data>::lowerBound (this=0x93708b8, akey=...) at /usr/include/qt/QtCore/qmap.h:145
#13 0xb5f94330 in QMapData<KStartupInfoId, KStartupInfo::Data>::findNode (this=0x9367b70, akey=...) at /usr/include/qt/QtCore/qmap.h:292
#14 0xb5f93688 in QMap<KStartupInfoId, KStartupInfo::Data>::remove (this=0x9344a40, akey=...) at /usr/include/qt/QtCore/qmap.h:897
#15 0xb5f8b999 in KStartupInfo::Private::remove_startup_info_internal (this=0x9344a38, id_P=...) at /home/bshah/kdesrc/frameworks/kwindowsystem/src/kstartupinfo.cpp:402
#16 0xb5f8da82 in KStartupInfo::Private::find_pid (this=0x9344a38, pid_P=7103, hostname_P=..., id_O=0xbfa1d974, data_O=0xbfa1d970) at /home/bshah/kdesrc/frameworks/kwindowsystem/src/kstartupinfo.cpp:868
#17 0xb5f8d555 in KStartupInfo::Private::check_startup_internal (this=0x9344a38, w_P=48234498, id_O=0xbfa1d974, data_O=0xbfa1d970) at /home/bshah/kdesrc/frameworks/kwindowsystem/src/kstartupinfo.cpp:792
#18 0xb5f8d179 in KStartupInfo::checkStartup (this=0x9327110, w_P=48234498, id_O=..., data_O=...) at /home/bshah/kdesrc/frameworks/kwindowsystem/src/kstartupinfo.cpp:741
#19 0xb7535398 in KWin::Workspace::checkStartupNotification (this=0x93378e8, w=48234498, id=..., data=...) at /home/bshah/kdesrc/kde/kde-workspace/kwin/workspace.cpp:1233
#20 0xb759d3c8 in KWin::Client::manage (this=0x956ead8, w=48234498, isMapped=false) at /home/bshah/kdesrc/kde/kde-workspace/kwin/manage.cpp:142
#21 0xb75328c1 in KWin::Workspace::createClient (this=0x93378e8, w=48234498, is_mapped=false) at /home/bshah/kdesrc/kde/kde-workspace/kwin/workspace.cpp:474
#22 0xb75841ca in KWin::Workspace::workspaceEvent (this=0x93378e8, e=0xb1706a70) at /home/bshah/kdesrc/kde/kde-workspace/kwin/events.cpp:316
#23 0xb7577199 in KWin::XcbEventFilter::nativeEventFilter (this=0x92ee5b0, eventType=..., message=0xb1706a70, result=0xbfa1de78) at /home/bshah/kdesrc/kde/kde-workspace/kwin/main.cpp:390
#24 0xb52cbb51 in QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) () from /usr/lib/libQt5Core.so.5
#25 0xb216321b in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#26 0xb21645a9 in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#27 0xb2188024 in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#28 0xb52f5c8f in QMetaCallEvent::placeMetaCall(QObject*) () from /usr/lib/libQt5Core.so.5
#29 0xb52f8e57 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5
#30 0xb5a27da6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#31 0xb5a2d7c1 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#32 0xb7576fe8 in KWin::Application::notify (this=0xbfa1e518, o=0x92aff10, e=0xb17068d0) at /home/bshah/kdesrc/kde/kde-workspace/kwin/main.cpp:344
#33 0xb52cdcbc in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#34 0xb52d017b in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5
#35 0xb531ec56 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#36 0xb21b7735 in ?? () from /usr/lib/qt/plugins/platforms/libqxcb.so
#37 0xb52cc3c8 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#38 0xb52cc7ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#39 0xb52d3816 in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#40 0xb55a79f4 in QGuiApplication::exec() () from /usr/lib/libQt5Gui.so.5
#41 0xb5a26584 in QApplication::exec() () from /usr/lib/libQt5Widgets.so.5
#42 0xb75787d2 in kdemain (argc=2, argv=0xbfa1e774) at /home/bshah/kdesrc/kde/kde-workspace/kwin/main.cpp:556
#43 0x08048b8e in main (argc=2, argv=0xbfa1e774) at /home/bshah/kdesrc/build/kde/kde-workspace/kwin/kwin_dummy.cpp:3


Reproducible: Always
Comment 1 Martin Flöser 2014-03-27 13:09:36 UTC
It crashes in relation to KstartupInfo handling, so it seems to be related to you starting apps (or clicking links in mails, etc.). I fixed there already one crash, but I need a condition to be able to reproduce to investigate myself. Reassign to kwindowsystem
Comment 2 Bhushan Shah 2014-03-27 13:11:22 UTC
Okay,I just reproduced, I started VLC media player by clicking a avi video file from dolphin
Comment 3 Martin Flöser 2014-03-27 13:27:31 UTC
> Okay,I just reproduced, I started VLC media player by clicking a avi video
> file from dolphin

doesn't happen for me :-(
Comment 4 Bhushan Shah 2014-04-22 15:03:08 UTC
I still can reproduce but totally random, we can either close it and reopen when someone reproduces it or keep it open. Choice is yours
Comment 5 Martin Flöser 2014-04-23 06:52:42 UTC
I just hit this crash for the very first time. Though also no idea how to 
reproduce:

Thread 1 (Thread 0x7fc3af872900 (LWP 7703)):
[KCrash Handler]
#5  __memcmp_sse4_1 () at ../sysdeps/x86_64/multiarch/memcmp-sse4.S:1322
#6  0x00007fc3a5b16f58 in qstrcmp (str1=..., str2=...) at 
tools/qbytearray.cpp:347
#7  0x00007fc3a765b796 in operator< (a1=..., a2=...) at 
/opt/qt5/include/QtCore/qbytearray.h:568
#8  0x00007fc3a7658465 in KStartupInfoId::operator< (this=0x3902dc8, id_P=...) 
at /home/martin/src/kf5/frameworks/kwindowsystem/src/kstartupinfo.cpp:1191
#9  0x00007fc3a765dcb5 in qMapLessThanKey<KStartupInfoId> (key1=..., key2=...) 
at /opt/qt5/include/QtCore/qmap.h:75
#10 0x00007fc3a765e595 in QMapNode<KStartupInfoId, 
KStartupInfo::Data>::lowerBound (this=0x3902db0, akey=...) at 
/opt/qt5/include/QtCore/qmap.h:145
#11 0x00007fc3a765dbb4 in QMapData<KStartupInfoId, 
KStartupInfo::Data>::findNode (this=0x2e18d10, akey=...) at 
/opt/qt5/include/QtCore/qmap.h:301
#12 0x00007fc3a765cd55 in QMap<KStartupInfoId, KStartupInfo::Data>::remove 
(this=0x242f5b0, akey=...) at /opt/qt5/include/QtCore/qmap.h:906
#13 0x00007fc3a76551e2 in KStartupInfo::Private::remove_startup_info_internal 
(this=0x242f5a0, id_P=...) at 
/home/martin/src/kf5/frameworks/kwindowsystem/src/kstartupinfo.cpp:398
#14 0x00007fc3a765740a in KStartupInfo::Private::find_wclass (this=0x242f5a0, 
_res_name=..., _res_class=..., id_O=0x7fffc7f74f50, data_O=0x7fffc7f74f40) at 
/home/martin/src/kf5/frameworks/kwindowsystem/src/kstartupinfo.cpp:875
#15 0x00007fc3a7656dd9 in KStartupInfo::Private::check_startup_internal 
(this=0x242f5a0, w_P=121634822, id_O=0x7fffc7f74f50, data_O=0x7fffc7f74f40) at 
/home/martin/src/kf5/frameworks/kwindowsystem/src/kstartupinfo.cpp:784
#16 0x00007fc3a7656906 in KStartupInfo::checkStartup (this=0x241af80, 
w_P=121634822, id_O=..., data_O=...) at 
/home/martin/src/kf5/frameworks/kwindowsystem/src/kstartupinfo.cpp:721
#17 0x00007fc3af263f03 in KWin::Workspace::checkStartupNotification 
(this=0x2424270, w=121634822, id=..., data=...) at 
/home/martin/src/kf5/kde/workspace/kwin/workspace.cpp:1233
#18 0x00007fc3af2d312a in KWin::Client::manage (this=0x2a18ac0, w=121634822, 
isMapped=false) at /home/martin/src/kf5/kde/workspace/kwin/manage.cpp:144
#19 0x00007fc3af2611a2 in KWin::Workspace::createClient (this=0x2424270, 
w=121634822, is_mapped=false) at 
/home/martin/src/kf5/kde/workspace/kwin/workspace.cpp:474
#20 0x00007fc3af2b8fae in KWin::Workspace::workspaceEvent (this=0x2424270, 
e=0x7fc390001b20) at /home/martin/src/kf5/kde/workspace/kwin/events.cpp:365
#21 0x00007fc3af2ab16a in KWin::XcbEventFilter::nativeEventFilter 
(this=0x2388440, eventType=..., message=0x7fc390001b20, result=0x7fffc7f75b78) 
at /home/martin/src/kf5/kde/workspace/kwin/main.cpp:390
#22 0x00007fc3a5d82e4b in QAbstractEventDispatcher::filterNativeEvent 
(this=0x234aad0, eventType=..., message=0x7fc390001b20, result=0x7fffc7f75b78) 
at kernel/qabstracteventdispatcher.cpp:468
#23 0x00007fc397a79651 in QXcbConnection::handleXcbEvent (this=0x2326200, 
event=0x7fc390001b20) at qxcbconnection.cpp:795
#24 0x00007fc397a7b3ed in QXcbConnection::processXcbEvents (this=0x2326200) at 
qxcbconnection.cpp:1204
#25 0x00007fc397ad1795 in QXcbConnection::qt_static_metacall (_o=0x2326200, 
_c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fc39000d380) at 
.moc/moc_qxcbconnection.cpp:179
#26 0x00007fc3a5dc1e53 in QMetaCallEvent::placeMetaCall (this=0x7fc39000d300, 
object=0x2326200) at kernel/qobject.cpp:487
#27 0x00007fc3a5dc2e96 in QObject::event (this=0x2326200, e=0x7fc39000d300) at 
kernel/qobject.cpp:1241
#28 0x00007fc3a6bfff04 in QApplicationPrivate::notify_helper (this=0x231ee20, 
receiver=0x2326200, e=0x7fc39000d300) at kernel/qapplication.cpp:3491
#29 0x00007fc3a6bfd696 in QApplication::notify (this=0x7fffc7f76b80, 
receiver=0x2326200, e=0x7fc39000d300) at kernel/qapplication.cpp:2944
#30 0x00007fc3af2aafe0 in KWin::Application::notify (this=0x7fffc7f76b80, 
o=0x2326200, e=0x7fc39000d300) at 
/home/martin/src/kf5/kde/workspace/kwin/main.cpp:344
#31 0x00007fc3a5d875de in QCoreApplication::notifyInternal 
(this=0x7fffc7f76b80, receiver=0x2326200, event=0x7fc39000d300) at 
kernel/qcoreapplication.cpp:935
#32 0x00007fc3a5d8b2c7 in QCoreApplication::sendEvent (receiver=0x2326200, 
event=0x7fc39000d300) at 
../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:237
#33 0x00007fc3a5d8893b in QCoreApplicationPrivate::sendPostedEvents 
(receiver=0x0, event_type=0, data=0x230f4b0) at 
kernel/qcoreapplication.cpp:1539
#34 0x00007fc3a5dfb2a3 in QEventDispatcherUNIX::processEvents (this=0x234aad0, 
flags=...) at kernel/qeventdispatcher_unix.cpp:587
#35 0x00007fc397b124a2 in QUnixEventDispatcherQPA::processEvents 
(this=0x234aad0, flags=...) at eventdispatchers/qunixeventdispatcher.cpp:70
#36 0x00007fc3a5d84294 in QEventLoop::processEvents (this=0x7fffc7f76a70, 
flags=...) at kernel/qeventloop.cpp:136
#37 0x00007fc3a5d84577 in QEventLoop::exec (this=0x7fffc7f76a70, flags=...) at 
kernel/qeventloop.cpp:212
#38 0x00007fc3a5d87cc7 in QCoreApplication::exec () at 
kernel/qcoreapplication.cpp:1188
#39 0x00007fc3a637dba4 in QGuiApplication::exec () at 
kernel/qguiapplication.cpp:1436
#40 0x00007fc3a6bfcec3 in QApplication::exec () at 
kernel/qapplication.cpp:2736
#41 0x00007fc3af2ac6dc in kdemain (argc=2, argv=0x7fffc7f771a8) at 
/home/martin/src/kf5/kde/workspace/kwin/main.cpp:556
#42 0x0000000000400cdf in main (argc=2, argv=0x7fffc7f771a8) at 
/opt/build/kf5/kde/workspace/kwin/kwin_dummy.cpp:3
Comment 6 Bhushan Shah 2014-04-23 07:01:33 UTC
(In reply to comment #5)
> I just hit this crash for the very first time. Though also no idea how to 
> reproduce:

To be sure, what you were doing when crash happened?
Comment 7 Martin Flöser 2014-04-23 07:04:03 UTC
> To be sure, what you were doing when crash happened?

I tried to open an email (KMail) attachment in Kate.
Comment 8 Bhushan Shah 2014-04-23 07:08:33 UTC
I can relate opening files.

- for you attachment
- me music files or movies
Comment 9 Martin Flöser 2014-04-23 08:16:43 UTC
And here it is: the unit test to reproduce the crash:

void KStartupInfo_UnitTest::checkStartupTest()
{
    KStartupInfoId id;
    KStartupInfoId id2;
    id.initId(QByteArrayLiteral("somefancyidwhichisrandom_kstartupinfo_unittest_0"));
    id2.initId(QByteArrayLiteral("somefancyidwhichisrandom_kstartupinfo_unittest_1"));

    KStartupInfoData data;
    data.setApplicationId(QStringLiteral("/dir with 
space/kstartupinfo_unittest.desktop"));
    data.setIcon(QStringLiteral("/dir with space/kstartupinfo_unittest.png"));
    data.setDescription(QStringLiteral("A description"));
    data.setName(QStringLiteral("A name"));
    data.setBin(QStringLiteral("dir with space/kstartupinfo_unittest"));

    // important for this test: WMClass
    const QByteArray wmClass = QByteArrayLiteral("kstartupinfotest");
    data.setWMClass(wmClass);

    xcb_connection_t *c = QX11Info::connection();
    xcb_window_t window = xcb_generate_id(c);
    uint32_t values[] = {XCB_EVENT_MASK_PROPERTY_CHANGE};
    xcb_create_window(c, XCB_COPY_FROM_PARENT, window,
                      QX11Info::appRootWindow(),
                      0, 0, 100, 100, 0, XCB_COPY_FROM_PARENT,
                      XCB_COPY_FROM_PARENT, XCB_CW_EVENT_MASK, values);

    xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, XCB_ATOM_WM_CLASS, 
XCB_ATOM_STRING, 8,
                        wmClass.length() * 2 + 1,
                        "kstartupinfotest\0kstartupinfotest");

    KStartupInfo info(KStartupInfo::DisableKWinModule | 
KStartupInfo::AnnounceSilenceChanges, this);
    KStartupInfo::sendStartup(id, data);
    KStartupInfo::sendStartup(id2, data);

    sync();
    QTest::qWait(100);

    QCOMPARE(info.checkStartup(window), KStartupInfo::Match);
    QCOMPARE(info.checkStartup(window), KStartupInfo::Match);
}
Comment 10 Martin Flöser 2014-04-23 09:35:53 UTC
Review Request created: https://git.reviewboard.kde.org/r/117701/
Comment 11 Bhushan Shah 2014-04-24 16:03:22 UTC
I have this patch applied and if I open link from konsole, and chrome/chromium is already running, whole X goes down. Can not reproduce every time but I reproduced it two times.
Comment 12 Thomas Lübking 2014-04-24 17:25:12 UTC
X11 crash -> Xorg bug.
Clients are not supposed to be able to crash the display server, no matter what they do.

Do you have  a backtrace in /var/log/Xorg.*.log* after this happens?
Comment 13 Bhushan Shah 2014-04-24 17:26:39 UTC
Not right now, but I'll try to get if  possible..
Comment 14 Martin Flöser 2014-04-25 07:02:55 UTC
Git commit ba3fe29fe342d20caf2ec694858d81b97afbfc2c by Martin Gräßlin.
Committed on 23/04/2014 at 09:23.
Pushed by graesslin into branch 'master'.

Fix crashers in KStartupInfo on remove while iterating

This is similar to the change ... just for more cases. If the API was
used with ::checkStartup it could happen that an item got removed from
the startups while iterating the list of startups. Thus the data
corrupted resulting in a crash when getting a similar crash.

In this case the code now uses erase instead of remove to have a valid
iterator.
REVIEW: 117701

M  +105  -0    autotests/kstartupinfo_unittest.cpp
M  +14   -6    src/kstartupinfo.cpp

http://commits.kde.org/kwindowsystem/ba3fe29fe342d20caf2ec694858d81b97afbfc2c