Bug 405592 - Kwin hangs randomly in _XReply()
Summary: Kwin hangs randomly in _XReply()
Status: RESOLVED UPSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: core (show other bugs)
Version: 5.13.5
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-18 12:52 UTC by Dmitry Osipenko
Modified: 2019-10-14 08:42 UTC (History)
1 user (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 Dmitry Osipenko 2019-03-18 12:52:34 UTC
This happens on an ARM tablet by interacting with desktop UI (moving windows around, pressing some button.. etc) using touchscreen. The hanging is very unpredictable and difficult to reproduce, it may not happen during a day or may may happen multiple times. It doesn't happen if compositing is disabled and seems it doesn't happen if mouse and keyboard are used instead of touchscreen. Restarting kwin process helps until it hangs again.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 18.10
KDE Plasma Version: 5.13.5
KDE Frameworks Version: 5.50.0
Qt Version: 5.11.1

ADDITIONAL INFORMATION

Here is a backtrace taken from kwin:

(gdb) thread apply all bt

Thread 5 (Thread 0xacbb9380 (LWP 2546)):
#0  0xb57f55a4 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb57f0708 in futex_wait_cancelable (private=0, expected=0, futex_word=0xb5cb3594 <QTWTF::pageheap_memory+20760>) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#2  0xb57f0708 in __pthread_cond_wait_common (abstime=0x0, mutex=0xb5cb3554 <QTWTF::pageheap_memory+20696>, cond=0xb5cb356c <QTWTF::pageheap_memory+20720>) at pthread_cond_wait.c:502
#3  0xb57f0708 in __pthread_cond_wait (cond=0xb5cb356c <QTWTF::pageheap_memory+20720>, mutex=0xb5cb3554 <QTWTF::pageheap_memory+20696>) at pthread_cond_wait.c:655
#4  0xb5c3c5e8 in QTWTF::TCMalloc_PageHeap::scavengerThread() (this=0xb5cae47c <QTWTF::pageheap_memory>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#5  0xb5c3c60a in QTWTF::TCMalloc_PageHeap::runScavengerThread(void*) (context=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#6  0xb57ebbc2 in start_thread (arg=0x2495e822) at pthread_create.c:486
#7  0xb6e5e43c in  () at ../sysdeps/unix/sysv/linux/arm/clone.S:73

Thread 4 (Thread 0xaf02f380 (LWP 2529)):
#0  0xb57f55a4 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb57f0708 in futex_wait_cancelable (private=0, expected=0, futex_word=0x674810) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#2  0xb57f0708 in __pthread_cond_wait_common (abstime=0x0, mutex=0x6747d0, cond=0x6747e8) at pthread_cond_wait.c:502
#3  0xb57f0708 in __pthread_cond_wait (cond=0x6747e8, mutex=0x6747d0) at pthread_cond_wait.c:655
#4  0xb5f7ddba in QWaitCondition::wait(QMutex*, unsigned long) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#5  0xb52d56c6 in QQmlThreadPrivate::wait() (this=<optimized out>) at qml/ftw/qqmlthread.cpp:371
#6  0xb52d56c6 in QQmlThread::internalCallMethodInMain(QQmlThread::Message*) (this=0x68b830, message=<optimized out>) at qml/ftw/qqmlthread.cpp:371
#7  0xb52b31de in QQmlImportDatabase::importDynamicPlugin(QString const&, QString const&, QString const&, int, QList<QQmlError>*)
    (this=this@entry=0xb0e06084, filePath=..., uri=..., typeNamespace=..., vmaj=<optimized out>, vmaj@entry=2, errors=<optimized out>, errors@entry=0xaf02e8f0)
    at /usr/include/arm-linux-gnueabihf/qt5/QtCore/qarraydata.h:206
#8  0xb52b3d7c in QQmlImportsPrivate::importExtension(QString const&, QString const&, int, int, QQmlImportDatabase*, QQmlTypeLoaderQmldirContent const&, QList<QQmlError>*)
    (this=0x7e9488, qmldirFilePath=..., uri=..., vmaj=vmaj@entry=2, vmin=vmin@entry=0, database=database@entry=0xb0e06084, qmldir=..., errors=errors@entry=0xaf02e8f0)
    at qml/qqmlimport.cpp:1115
#9  0xb52b4682 in QQmlImportsPrivate::addLibraryImport(QString const&, QString const&, int, int, QString const&, QString const&, bool, QQmlImportDatabase*, QList<QQmlError>*)
    (this=<optimized out>, uri=..., prefix=..., vmaj=vmaj@entry=2, vmin=vmin@entry=0, qmldirIdentifier=..., qmldirUrl=..., incomplete=incomplete@entry=false, database=database@entry=0xb0e06084, errors=errors@entry=0xaf02e8f0) at qml/qqmlimport.cpp:1456
#10 0xb52b4778 in QQmlImports::addLibraryImport(QQmlImportDatabase*, QString const&, QString const&, int, int, QString const&, QString const&, bool, QList<QQmlError>*)
    (this=this@entry=0x7f137c, importDb=importDb@entry=0xb0e06084, uri=..., prefix=..., vmaj=vmaj@entry=2, vmin=0, qmldirIdentifier=..., qmldirUrl=..., incomplete=incomplete@entry=false, errors=errors@entry=0xaf02e8f0) at qml/qqmlimport.cpp:1699
#11 0xb528939c in QQmlTypeLoader::Blob::addImport(QV4::CompiledData::Import const*, QList<QQmlError>*) (this=this@entry=0x7f1348, import=<optimized out>,
    import@entry=0xaf200e38, errors=errors@entry=0xaf02e8f0) at qml/qqmltypeloader.cpp:1418
#12 0xb5289dce in QQmlTypeData::tryLoadFromDiskCache() (this=this@entry=0x7f1348) at qml/qqmltypeloader.cpp:2175
#13 0xb528af04 in QQmlTypeData::dataReceived(QQmlDataBlob::SourceCodeData const&) (this=0x7f1348, data=...) at qml/qqmltypeloader.cpp:2437
#14 0xb5284b40 in QQmlTypeLoader::setData(QQmlDataBlob*, QQmlDataBlob::SourceCodeData const&) (this=this@entry=0xb0e060b4, blob=blob@entry=0x7f1348, d=...) at qml/qqmltypeloader.cpp:1284
#15 0xb5285146 in QQmlTypeLoader::setData(QQmlDataBlob*, QString const&) (this=this@entry=0xb0e060b4, blob=0x7f1348, fileName=...) at qml/qqmltypeloader.cpp:1274
#16 0xb5285bc0 in QQmlTypeLoader::loadThread(QQmlDataBlob*) (this=0xb0e060b4, blob=<optimized out>, blob@entry=0x7f1348) at qml/qqmltypeloader.cpp:1147
#17 0xb5285d2e in QQmlTypeLoaderThread::loadThread(QQmlDataBlob*) (this=<optimized out>, b=0x7f1348) at qml/qqmltypeloader.cpp:890
#18 0xb52d5424 in QQmlThreadPrivate::threadEvent() (this=0x67cf20) at qml/ftw/qqmlthread.cpp:197
#19 0xb52d5894 in QQmlThreadPrivate::event(QEvent*) (this=0x67cf20, e=0x6d7080) at qml/ftw/qqmlthread.cpp:135
#20 0xb66f193a in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#21 0xb66f6f8e in QApplication::notify(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#22 0x0067cf20 in  ()

Thread 3 (Thread 0xb04cd380 (LWP 2496)):
#0  0xb6ddb704 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb6e57368 in __GI_ppoll (fds=0x5de828, nfds=4, timeout=<optimized out>, sigmask=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:39
#2  0xb60d0eb2 in qt_safe_poll(pollfd*, unsigned long, timespec const*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#3  0xb60d1fa0 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#4  0xb6096800 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#5  0xb5f762ea in QThread::exec() () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#6  0xb4f119d6 in  () at /usr/lib/arm-linux-gnueabihf/libQt5DBus.so.5

Thread 2 (Thread 0xb17a7380 (LWP 2428)):
#0  0xb6ddb704 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb6e572b0 in __GI___poll (fds=fds@entry=0xb17a6c94, nfds=nfds@entry=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#2  0xb6ae196c in poll (__timeout=-1, __nfds=1, __fds=0xb17a6c94) at /usr/include/arm-linux-gnueabihf/bits/poll2.h:46
#3  0xb6ae196c in _xcb_conn_wait (c=c@entry=0x52a258, cond=cond@entry=0x52a280, vector=vector@entry=0x0, count=count@entry=0x0) at ../../src/xcb_conn.c:479
#4  0xb6ae2e26 in xcb_wait_for_event (c=0x52a258) at ../../src/xcb_in.c:697
#5  0xb18bafac in QXcbEventReader::run() (this=0x510ad0) at qxcbconnection.h:409
#6  0xb5f7d5d8 in  () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#7  0xb57ebbc2 in start_thread (arg=0x2495e822) at pthread_create.c:486
#8  0xb6e5e43c in  () at ../sysdeps/unix/sysv/linux/arm/clone.S:73

Thread 1 (Thread 0xb1e3eb00 (LWP 2426)):
#0  0xb57f55a4 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb57f0708 in futex_wait_cancelable (private=0, expected=0, futex_word=0x529d60) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#2  0xb57f0708 in __pthread_cond_wait_common (abstime=0x0, mutex=0x529da8, cond=0x529d38) at pthread_cond_wait.c:502
#3  0xb57f0708 in __pthread_cond_wait (cond=0x529d38, mutex=0x529da8) at pthread_cond_wait.c:655
#4  0xb4d930ea in _XReply (dpy=dpy@entry=0x5254c0, rep=rep@entry=0xbef6b634, extra=extra@entry=0, discard=discard@entry=1) at ../../src/xcb_io.c:603
#5  0xb4d94bf0 in _XSeqSyncFunction (dpy=0x5254c0) at ../../src/XlibInt.c:203
#6  0xb4d94728 in _XError (dpy=dpy@entry=0x5254c0, rep=rep@entry=0xb0e177f0) at ../../src/XlibInt.c:1446
#7  0xb4d92542 in handle_error (dpy=0x5254c0, err=0xb0e177f0, in_XReply=<optimized out>) at ../../src/xcb_io.c:199
#8  0xb4d925b8 in handle_response (dpy=dpy@entry=0x5254c0, response=0xb0e177f0, in_XReply=in_XReply@entry=1) at ../../src/xcb_io.c:324
#9  0xb4d930ca in _XReply (dpy=dpy@entry=0x5254c0, rep=rep@entry=0xbef6b7b4, extra=extra@entry=0, discard=discard@entry=1) at ../../src/xcb_io.c:655
#10 0xb4d94bf0 in _XSeqSyncFunction (dpy=0x5254c0) at ../../src/XlibInt.c:203
#11 0xb4d94728 in _XError (dpy=dpy@entry=0x5254c0, rep=rep@entry=0xb0e10da8) at ../../src/XlibInt.c:1446
#12 0xb4d92542 in handle_error (dpy=0x5254c0, err=0xb0e10da8, in_XReply=<optimized out>) at ../../src/xcb_io.c:199
#13 0xb4d925b8 in handle_response (dpy=dpy@entry=0x5254c0, response=0xb0e10da8, in_XReply=in_XReply@entry=1) at ../../src/xcb_io.c:324
#14 0xb4d930ca in _XReply (dpy=dpy@entry=0x5254c0, rep=rep@entry=0xbef6b994, extra=extra@entry=0, discard=discard@entry=1) at ../../src/xcb_io.c:655
#15 0xb4d85ea0 in XInternAtoms (dpy=0x5254c0, names=names@entry=0xbef6b9e8, count=count@entry=4, onlyIfExists=onlyIfExists@entry=0, atoms_return=atoms_return@entry=0xbef6ba38)
    at ../../src/IntAtom.c:285
#16 0xaf0392ca in create_atoms() () at ./src/platforms/xcb/kwindowsystem.cpp:432
#17 0xaf0396d6 in create_atoms () at ./src/platforms/xcb/kwindowsystem.cpp:156
#18 0xaf0396d6 in NETEventFilter::NETEventFilter(KWindowSystemPrivateX11::FilterInfo) (this=0xb0e131d0, _what=KWindowSystemPrivateX11::INFO_BASIC)
    at ./src/platforms/xcb/kwindowsystem.cpp:145
#19 0xaf039a12 in MainThreadInstantiator::createNETEventFilter() (this=0xbef6bc18) at ./src/platforms/xcb/kwindowsystem.cpp:487
#20 0xaf039a12 in KWindowSystemPrivateX11::init(KWindowSystemPrivateX11::FilterInfo) (this=this@entry=0x682da0, what=<optimized out>, what@entry=KWindowSystemPrivateX11::INFO_BASIC)
    at ./src/platforms/xcb/kwindowsystem.cpp:487
#21 0xaf039c2e in KWindowSystemPrivateX11::compositingActive() (this=0x682da0) at ./src/platforms/xcb/kwindowsystem.cpp:882
#22 0xb5b2cae8 in Plasma::ThemePrivate::ThemePrivate(QObject*) (this=0x766dd8, parent=<optimized out>) at /usr/include/arm-linux-gnueabihf/qt5/QtCore/qarraydata.h:255
#23 0xb5b24956 in Plasma::Theme::Theme(QObject*) (this=0x677040, parent=<optimized out>) at ./src/plasma/theme.cpp:55
#24 0xabc7c258 in Plasma::QuickTheme::QuickTheme(QObject*) (this=0x677040, parent=<optimized out>) at ./src/declarativeimports/core/quicktheme.cpp:27
#25 0xabc6560c in CoreBindingsPlugin::initializeEngine(QQmlEngine*, char const*) (this=<optimized out>, engine=0xb0e054d0, uri=<optimized out>)
    at ./src/declarativeimports/core/corebindingsplugin.cpp:59
#26 0xb52d5626 in QQmlThread::internalCallMethodInThread(QQmlThread::Message*) (this=0x68b830, message=<optimized out>) at qml/ftw/qqmlthread.cpp:334
#27 0xb5281c48 in QQmlThread::callMethodInThread<QQmlDataBlob*, QQmlDataBlob*, QQmlTypeLoaderThread>(void (QQmlTypeLoaderThread::*)(QQmlDataBlob*), QQmlDataBlob* const&)
    (arg=<synthetic pointer>: <optimized out>, Member=<optimized out>, this=<optimized out>) at ../../include/QtQml/5.11.1/QtQml/private/../../../../../src/qml/qml/ftw/qqmlthread_p.h:161
#28 0xb5281c48 in QQmlTypeLoaderThread::load(QQmlDataBlob*) (this=<optimized out>, b=<optimized out>) at qml/qqmltypeloader.cpp:827
#29 0xb529056e in PlainLoader::load(QQmlTypeLoader*, QQmlDataBlob*) const (this=<optimized out>, loader=0xb0e060b4, blob=0x7f1348) at qml/qqmltypeloader.cpp:996
#30 0xb529056e in QQmlTypeLoader::doLoad<PlainLoader>(PlainLoader const&, QQmlDataBlob*, QQmlTypeLoader::Mode)
    (this=0xb0e060b4, loader=..., blob=0x7f1348, mode=QQmlTypeLoader::PreferSynchronous) at qml/qqmltypeloader.cpp:1060
#31 0xb5285d52 in QQmlTypeLoader::load(QQmlDataBlob*, QQmlTypeLoader::Mode) (this=this@entry=0xb0e060b4, blob=blob@entry=0x7f1348, mode=mode@entry=QQmlTypeLoader::PreferSynchronous)
    at qml/qqmltypeloader.cpp:1083
#32 0xb5286f7a in QQmlTypeLoader::getType(QUrl const&, QQmlTypeLoader::Mode) (this=0xb0e060b4, unNormalizedUrl=..., mode=mode@entry=QQmlTypeLoader::PreferSynchronous)
    at qml/qqmltypeloader.cpp:1692
#33 0xb526efaa in QQmlComponentPrivate::loadUrl(QUrl const&, QQmlComponent::CompilationMode) (this=0x6d9ac0, newUrl=..., mode=mode@entry=QQmlComponent::PreferSynchronous)
    at /usr/include/arm-linux-gnueabihf/qt5/QtCore/qglobal.h:1038
#34 0xb526f29c in QQmlComponent::loadUrl(QUrl const&) (this=this@entry=0x7287e0, url=...) at qml/qqmlcomponent.cpp:618
#35 0xb6c8dd42 in KWin::CompositedOutlineVisual::show() (this=0x64cbd0) at ./outline.cpp:177
#36 0xb6c8d934 in KWin::Outline::show() (this=0x65d488) at ./outline.cpp:63
#37 0xb6c8da12 in KWin::Outline::show(QRect const&, QRect const&) (this=<optimized out>, outlineGeometry=..., visualParentGeometry=...) at ./outline.cpp:90
#38 0xb6cb5472 in KWin::AbstractClient::setElectricBorderMaximizing(bool) (this=this@entry=0x766978, maximizing=maximizing@entry=true) at ./abstract_client.h:913
#39 0xb6c47d04 in KWin::AbstractClient::checkQuickTilingMaximizationZones(int, int) (this=0x766978, xroot=<optimized out>, yroot=<optimized out>) at ./abstract_client.cpp:1337
#40 0xb6c8feaa in KWin::Client::motionNotifyEvent(unsigned int, int, int, int, int, int) (this=0x766978, w=25364052, state=256, x=-17, y=0, x_root=98, y_root=5)
    at /usr/include/arm-linux-gnueabihf/qt5/QtCore/qpoint.h:122
#41 0xb6c90ab8 in KWin::Client::windowEvent(xcb_generic_event_t*) (this=0x766978, e=e@entry=0xb0e15fb8) at ./events.cpp:521
#42 0xb6d37284 in KWin::MovingClientX11Filter::<lambda(xcb_window_t)>::operator() (__closure=<synthetic pointer>, __closure=<synthetic pointer>, window=<optimized out>)
    at ./moving_client_x11_filter.cpp:51
#43 0xb6d37284 in KWin::MovingClientX11Filter::event(xcb_generic_event_t*) (this=<optimized out>, event=0xb0e15fb8) at ./moving_client_x11_filter.cpp:57
#44 0xb6c90d44 in KWin::Workspace::workspaceEvent(xcb_generic_event_t*) (this=0x5f5ae0, e=0xb0e15fb8) at ./x11eventfilter.h:51
#45 0xb609586c in QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#46 0xb18bc070 in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) (this=this@entry=0x525188, event=event@entry=0xb0e15fb8) at qxcbnativeinterface.h:101
#47 0xb18bc7f2 in QXcbConnection::processXcbEvents() (this=0x525188) at qxcbconnection.cpp:1787
#48 0xb60b5294 in QObject::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#49 0xb66f193a in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#50 0xb66f6f8e in QApplication::notify(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#51 0x00525188 in  ()

IIUC, it's Thread 1 that is stuck. Thread 2 is active and processing inputs.

Here is what xError contains:

(gdb) print *(xError*)0xb0e10da8
$1 = {type = 0 '\000', errorCode = 3 '\003', sequenceNumber = 45126, resourceID = 2848, minorCode = 53, majorCode = 131 '\203', pad1 = 0 '\000', pad3 = 0, pad4 = 0, pad5 = 0, pad6 = 0,
  pad7 = 0}

(gdb) print *(xError*)0xb0e177f0
$2 = {type = 0 '\000', errorCode = 3 '\003', sequenceNumber = 10243, resourceID = 2849, minorCode = 53, majorCode = 131 '\203', pad1 = 0 '\000', pad3 = 0, pad4 = 0, pad5 = 0, pad6 = 0,
  pad7 = 0}

The errorCode=3 should mean "BadWindow", but ProcInternAtom() of Xorg server doesn't return that error code.

Here is a backtrace from another hang:

Thread 5 (Thread 0xacbf7380 (LWP 3588)):
#0  0xb58355a4 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb5830708 in futex_wait_cancelable (private=0, expected=0, futex_word=0xb5cf3594 <QTWTF::pageheap_memory+20760>) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#2  0xb5830708 in __pthread_cond_wait_common (abstime=0x0, mutex=0xb5cf3554 <QTWTF::pageheap_memory+20696>, cond=0xb5cf356c <QTWTF::pageheap_memory+20720>) at pthread_cond_wait.c:502
#3  0xb5830708 in __pthread_cond_wait (cond=0xb5cf356c <QTWTF::pageheap_memory+20720>, mutex=0xb5cf3554 <QTWTF::pageheap_memory+20696>) at pthread_cond_wait.c:655
#4  0xb5c7c5e8 in QTWTF::TCMalloc_PageHeap::scavengerThread() (this=0xb5cee47c <QTWTF::pageheap_memory>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#5  0xb5c7c60a in QTWTF::TCMalloc_PageHeap::runScavengerThread(void*) (context=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#6  0xb582bbc2 in start_thread (arg=0xca07d227) at pthread_create.c:486
#7  0xb6e9e43c in  () at ../sysdeps/unix/sysv/linux/arm/clone.S:73

Thread 4 (Thread 0xaf06d380 (LWP 3586)):
#0  0xb6e1b704 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb6e97368 in __GI_ppoll (fds=0x5be750, nfds=1, timeout=<optimized out>, sigmask=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:39
#2  0xb6110eb2 in qt_safe_poll(pollfd*, unsigned long, timespec const*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#3  0xb6111fa0 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#4  0xb60d6800 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#5  0xb5fb62ea in QThread::exec() () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#6  0xb53151dc in QQmlThreadPrivate::run() (this=0x5d1430) at qml/ftw/qqmlthread.cpp:148
#7  0xb5fbd5d8 in  () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#8  0xb582bbc2 in start_thread (arg=0xca07d227) at pthread_create.c:486
#9  0xb6e9e43c in  () at ../sysdeps/unix/sysv/linux/arm/clone.S:73

Thread 3 (Thread 0xb050d380 (LWP 3545)):
#0  0xb6e1b704 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb6e97368 in __GI_ppoll (fds=0xaf100a08, nfds=4, timeout=<optimized out>, sigmask=0x0) at ../sysdeps/unix/sysv/linux/ppoll.c:39
#2  0xb6110eb2 in qt_safe_poll(pollfd*, unsigned long, timespec const*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#3  0xb6111fa0 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#4  0xb60d6800 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#5  0xb5fb62ea in QThread::exec() () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#6  0xb4f519d6 in  () at /usr/lib/arm-linux-gnueabihf/libQt5DBus.so.5

Thread 2 (Thread 0xb17e7380 (LWP 3487)):
#0  0xb6e1b704 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb6e972b0 in __GI___poll (fds=fds@entry=0xb17e6c94, nfds=nfds@entry=1, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#2  0xb6b2196c in poll (__timeout=-1, __nfds=1, __fds=0xb17e6c94) at /usr/include/arm-linux-gnueabihf/bits/poll2.h:46
#3  0xb6b2196c in _xcb_conn_wait (c=c@entry=0x496258, cond=cond@entry=0x496280, vector=vector@entry=0x0, count=count@entry=0x0) at ../../src/xcb_conn.c:479
#4  0xb6b22e26 in xcb_wait_for_event (c=0x496258) at ../../src/xcb_in.c:697
#5  0xb18fafac in QXcbEventReader::run() (this=0x47cad0) at qxcbconnection.h:409
#6  0xb5fbd5d8 in  () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#7  0xb582bbc2 in start_thread (arg=0xca07d227) at pthread_create.c:486
#8  0xb6e9e43c in  () at ../sysdeps/unix/sysv/linux/arm/clone.S:73

Thread 1 (Thread 0xb1e7eb00 (LWP 3468)):
#0  0xb58355a4 in __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
#1  0xb5830708 in futex_wait_cancelable (private=0, expected=0, futex_word=0x495d60) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#2  0xb5830708 in __pthread_cond_wait_common (abstime=0x0, mutex=0x495da8, cond=0x495d38) at pthread_cond_wait.c:502
#3  0xb5830708 in __pthread_cond_wait (cond=0x495d38, mutex=0x495da8) at pthread_cond_wait.c:655
#4  0xb4dd30ea in _XReply (dpy=dpy@entry=0x4914c0, rep=rep@entry=0xbeb6eb34, extra=extra@entry=0, discard=discard@entry=1) at ../../src/xcb_io.c:603
#5  0xb4dd4bf0 in _XSeqSyncFunction (dpy=0x4914c0) at ../../src/XlibInt.c:203
#6  0xb4dd4728 in _XError (dpy=dpy@entry=0x4914c0, rep=rep@entry=0xb0e013b0) at ../../src/XlibInt.c:1446
#7  0xb4dd2542 in handle_error (dpy=0x4914c0, err=0xb0e013b0, in_XReply=<optimized out>) at ../../src/xcb_io.c:199
#8  0xb4dd25b8 in handle_response (dpy=dpy@entry=0x4914c0, response=0xb0e013b0, in_XReply=in_XReply@entry=1) at ../../src/xcb_io.c:324
#9  0xb4dd30ca in _XReply (dpy=dpy@entry=0x4914c0, rep=rep@entry=0xbeb6ecb4, extra=extra@entry=0, discard=discard@entry=1) at ../../src/xcb_io.c:655
#10 0xb4dd4bf0 in _XSeqSyncFunction (dpy=0x4914c0) at ../../src/XlibInt.c:203
#11 0xb4dd1630 in XGetVisualInfo
    (dpy=dpy@entry=0x4914c0, visual_info_mask=visual_info_mask@entry=1, visual_info_template=visual_info_template@entry=0xbeb6eda4, nitems=nitems@entry=0xbeb6ed8c) at ../../src/VisUtil.c:71
#12 0xb19ee904 in QXlibEglIntegration::getCompatibleVisualId(_XDisplay*, void*, void*) (display=display@entry=0x4914c0, eglDisplay=0x5086e0, config=<optimized out>)
    at qxlibeglintegration.cpp:76
#13 0xb19eb738 in QXcbEglWindow::createVisual() (this=0x502b28) at qxcbeglintegration.h:73
#14 0xb190f60a in QXcbWindow::create() (this=this@entry=0x502b28) at qxcbwindow.cpp:389
#15 0xb19eb798 in QXcbEglWindow::create() (this=0x502b28) at qxcbeglwindow.cpp:94
#16 0xb1900894 in QXcbIntegration::createPlatformWindow(QWindow*) const (this=<optimized out>, window=<optimized out>) at qxcbintegration.cpp:248
#17 0xb63cc87c in QWindowPrivate::create(bool, unsigned int) (this=0x71bf48, recursive=<optimized out>, nativeHandle=0) at kernel/qwindow.cpp:515
#18 0xb675366c in QWidgetPrivate::create_sys(unsigned int, bool, bool) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#19 0xb6753aa8 in QWidget::create(unsigned int, bool, bool) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#20 0xb675c7fe in QWidget::setVisible(bool) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#21 0xb674a764 in QToolTip::showText(QPoint const&, QString const&, QWidget*, QRect const&, int) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#22 0xb674a79e in QToolTip::showText(QPoint const&, QString const&, QWidget*, QRect const&) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#23 0xb674a7c8 in QToolTip::showText(QPoint const&, QString const&, QWidget*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#24 0xb6d52fe0 in KWin::Decoration::DecoratedClientImpl::<lambda()>::operator() (__closure=0x70a480) at ./decorations/decoratedclient.cpp:125
#25 0xb6d52fe0 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, KWin::Decoration::DecoratedClientImpl::DecoratedClientImpl(KWin::AbstractClient*, KDecoration2::DecoratedClient*, KDecoration2::Decoration*)::<lambda()> >::call (arg=<optimized out>, f=...) at /usr/include/arm-linux-gnueabihf/qt5/QtCore/qobjectdefs_impl.h:128
#26 0xb6d52fe0 in QtPrivate::Functor<KWin::Decoration::DecoratedClientImpl::DecoratedClientImpl(KWin::AbstractClient*, KDecoration2::DecoratedClient*, KDecoration2::Decoration*)::<lambda()>, 0>::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...) at /usr/include/arm-linux-gnueabihf/qt5/QtCore/qobjectdefs_impl.h:238
#27 0xb6d52fe0 in QtPrivate::QFunctorSlotObject<KWin::Decoration::DecoratedClientImpl::DecoratedClientImpl(KWin::AbstractClient*, KDecoration2::DecoratedClient*, KDecoration2::Decoration*)::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x70a478, r=<optimized out>, a=<optimized out>, ret=0x0)
    at /usr/include/arm-linux-gnueabihf/qt5/QtCore/qobjectdefs_impl.h:421
#28 0xb60f4d70 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#29 0xb60fd134 in QTimer::timeout(QTimer::QPrivateSignal) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#30 0xb60f5266 in QObject::event(QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Core.so.5
#31 0xb673193a in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#32 0xb6736f8e in QApplication::notify(QObject*, QEvent*) () at /usr/lib/arm-linux-gnueabihf/libQt5Widgets.so.5
#33 0xb0e062a8 in  ()

(gdb) print *(xError*)0xb0e013b0
$1 = {type = 0 '\000', errorCode = 3 '\003', sequenceNumber = 60402, resourceID = 37, minorCode = 53, majorCode = 131 '\203', pad1 = 0 '\000', pad3 = 0, pad4 = 0, pad5 = 0, pad6 = 0, 
  pad7 = 0}

It always hangs with a similar conditions in _XReply().

Running kwin from terminal produces errors like this:

qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 19497, resource id: 25167384, major code: 3 (GetWindowAttributes), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 19498, resource id: 25167384, major code: 14 (GetGeometry), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 19501, resource id: 25167384, major code: 3 (GetWindowAttributes), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 19502, resource id: 25167384, major code: 14 (GetGeometry), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 35477, resource id: 25168614, major code: 20 (GetProperty), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 46498, resource id: 25169481, major code: 20 (GetProperty), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 46581, resource id: 25169481, major code: 3 (GetWindowAttributes), minor code: 0
qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 46582, resource id: 25169481, major code: 14 (GetGeometry), minor code: 0

But these errors seems to be okay because I'm getting them on other machines as well. It feels like there is a race condition somewhere and just happens that using touchscreen as input device on that tablet makes it easy to trigger the bug.

Any thoughts? I could try patches and collect additional debug info if needed.
Comment 1 Martin Flöser 2019-03-18 20:36:39 UTC
From the backtraces it looks like a problem in xlib. In both cases we do an xlib call which then triggers an error which goes back into xlib. I can understand how that can end up deadlocking in xlib. In both cases the triggering code is not in KWin, once it's KWindowsystem, once it's Qt. KWin itself is mostly Xlib free, but of course OpenGL requires Xlib.

The issue might be arm specific.

My suggestion is to give Wayland a try, it should perform better on arm and won't be able to trigger this issue.
Comment 2 Dmitry Osipenko 2019-03-18 21:01:26 UTC
Thank you for the comment, Martin. Yes, it looks like the problem should be in libx11. I'll try to hack the x11 library, avoiding the offending recursive _XReply().. will see what will be the result. I'll also open a bug against the libx11 afterwards. And yes, it could be arm-specific problem as well.. maybe code isn't properly portable in some place.

Wayland isn't an option because there is no proper 3d driver for the device, it's a relatively old hardware. Meanwhile there is opensource Xorg video driver that brings some acceleration and Plasma 5 works excellent performance-wise with it, just need to find a cure for the hang-issue.
Comment 3 Dmitry Osipenko 2019-03-24 15:52:48 UTC
I opened libx11 bug here: https://gitlab.freedesktop.org/xorg/lib/libx11/issues/93

I also reproduced the problem with other desktop environments, so please feel free to close this bug since very likely it's not a kwin's fault.
Comment 4 Martin Flöser 2019-03-24 18:50:05 UTC
Upstream issue
Comment 5 Paraddi 2019-10-12 05:57:13 UTC
I was able to compile build libX11-1.6.9 from libX11-1.6.9.tar.gz in the https://www.x.org/releases/individual/lib/ and was able to build and freeze it by increasing the CPU load of the Qt Application by quickly switching two buttons in the HMI through touch.

Other related components in the machine are as follows,
Qt 5.9.7, KWIN 4.11.19-8, libXi 1.7.9-1 , xinput 1.6.2 and x11-server 1.20.1-5.6

[local@bues3-sun724 ~]$ pstack 2883

Thread 3 (Thread 0x7f994c3af700 (LWP 2885)):

#0  0x00007f995cafd20d in poll () from /lib64/libc.so.6

#1  0x00007f995539c082 in _xcb_conn_wait () from /lib64/libxcb.so.1

#2  0x00007f995539de6f in xcb_wait_for_event () from /lib64/libxcb.so.1

#3  0x00007f994eb6fe19 in QXcbEventReader::run() () from /lib64/libQt5XcbQpa.so.5

#4  0x00007f995d85be71 in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5

#5  0x00007f995d2f6dd5 in start_thread () from /lib64/libpthread.so.0

#6  0x00007f995cb07ead in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f9949d6b700 (LWP 3041)):

#0  0x00007f995cafd20d in poll () from /lib64/libc.so.6

#1  0x00007f9958bf5c4c in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0

#2  0x00007f9958bf5d7c in g_main_context_iteration () from /lib64/libglib-2.0.so.0

#3  0x00007f995da5445c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5

#4  0x00007f995da046db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5

#5  0x00007f995d8577f8 in QThread::exec() () from /lib64/libQt5Core.so.5

#6  0x00007f994eabb3b5 in QDBusConnectionManager::run() () from /lib64/libQt5DBus.so.5

#7  0x00007f995d85be71 in QThreadPrivate::start(void*) () from /lib64/libQt5Core.so.5

#8  0x00007f995d2f6dd5 in start_thread () from /lib64/libpthread.so.0

#9  0x00007f995cb07ead in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f995ff27900 (LWP 2883)):

#0  0x00007f995d2fa965 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0

#1  0x00007f995603a685 in _XReply (dpy=dpy@entry=0xb3dd60, rep=rep@entry=0x7ffcea17fbc0, extra=extra@entry=0, discard=discard@entry=1) at xcb_io.c:603

#2  0x00007f995603cf33 in _XSeqSyncFunction (dpy=0xb3dd60) at XlibInt.c:224

#3  0x00007f995603c753 in _XError (dpy=dpy@entry=0xb3dd60, rep=rep@entry=0x7f9944004500) at XlibInt.c:1493

#4  0x00007f9956039867 in handle_error (dpy=0xb3dd60, err=0x7f9944004500, in_XReply=<optimized out>) at xcb_io.c:199

#5  0x00007f9956039915 in handle_response (dpy=0xb3dd60, response=0x7f9944004500, in_XReply=<optimized out>) at xcb_io.c:324

#6  0x00007f995603a75a in _XReply (dpy=0xb3dd60, rep=0x7ffcea17fdf0, extra=0, discard=0) at xcb_io.c:656

#7  0x00007f994e69e2fe in XIQueryDevice () from /lib64/libXi.so.6

#8  0x00007f994eb972bf in QXcbConnection::handleEnterEvent() () from /lib64/libQt5XcbQpa.so.5

#9  0x00007f994eb82c47 in QXcbWindow::handleEnterNotifyEvent(int, int, int, int, unsigned char, unsigned char, unsigned int) () from /lib64/libQt5XcbQpa.so.5

#10 0x00007f994eb83193 in QXcbWindow::handleXIEnterLeave(xcb_ge_event_t*) () from /lib64/libQt5XcbQpa.so.5

#11 0x00007f994eb99f8c in QXcbConnection::xi2HandleEvent(xcb_ge_event_t*) () from /lib64/libQt5XcbQpa.so.5

#12 0x00007f994eb6e2a2 in QXcbConnection::handleXcbEvent(xcb_generic_event_t*) () from /lib64/libQt5XcbQpa.so.5

#13 0x00007f994eb7019e in QXcbConnection::processXcbEvents() () from /lib64/libQt5XcbQpa.so.5

#14 0x00007f995da2f1de in QObject::event(QEvent*) () from /lib64/libQt5Core.so.5

#15 0x00007f995e3fdd8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5

#16 0x00007f995e404f68 in QApplication::notify(QObject*, QEvent*) () from /lib64/libQt5Widgets.so.5

#17 0x00007f995da05be6 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt5Core.so.5

#18 0x00007f995da08503 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /lib64/libQt5Core.so.5

#19 0x00007f995da54ab3 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt5Core.so.5

#20 0x00007f9958bf5969 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0

#21 0x00007f9958bf5cc8 in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0

#22 0x00007f9958bf5d7c in g_main_context_iteration () from /lib64/libglib-2.0.so.0

#23 0x00007f995da5445c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5

#24 0x00007f995da046db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt5Core.so.5

#25 0x00007f995da0cc04 in QCoreApplication::exec() () from /lib64/libQt5Core.so.5

#26 0x00000000004263a9 in main ()

[local@bues3-sun724 ~]$
Comment 6 Vlad Zahorodnii 2019-10-14 08:42:26 UTC
That's an upstream issue.