Bug 426200 - Under wayland kpatience crashes on window resize
Summary: Under wayland kpatience crashes on window resize
Status: RESOLVED UPSTREAM
Alias: None
Product: kpat
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2020-09-05 04:53 UTC by Jason Playne
Modified: 2021-01-13 18:44 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
New crash information added by DrKonqi (5.51 KB, text/plain)
2020-09-20 23:44 UTC, Neal Gompa
Details
New crash information added by DrKonqi (6.34 KB, text/plain)
2020-09-21 00:27 UTC, Neal Gompa
Details
strace of kpat crashing (2.40 MB, text/plain)
2020-09-21 00:59 UTC, Jason Playne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Playne 2020-09-05 04:53:04 UTC
Application: kpat (20.08.1)

Qt Version: 5.14.2
Frameworks Version: 5.73.0
Operating System: Linux 5.8.6-050806-generic x86_64
Windowing system: Wayland
Distribution: KDE neon User Edition 5.19

-- Information about the crash:
- What I was doing when the application crashed:
I was wanting to play, so I launch the app and when to move the window

I tried a few times and it is some variant of: launch app, double click title or resize window that causes the app to crash

- Unusual behavior I noticed:

after crash there is a 50% translucent ghost of kpatience covering my desktop.

The crash can be reproduced every time.

-- Backtrace:
Application: KPatience (kpat), signal: Aborted

[KCrash Handler]
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#5  0x00007f0bd10d9859 in __GI_abort () at abort.c:79
#6  0x00007f0bd1665b69 in qt_message_fatal (context=..., message=<synthetic pointer>...) at global/qlogging.cpp:1914
#7  QMessageLogger::fatal (this=<optimized out>, msg=<optimized out>) at global/qlogging.cpp:893
#8  0x00007f0bcc70a8b5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5WaylandClient.so.5
#9  0x00007f0bcc71b0de in QtWaylandClient::QWaylandDisplay::flushRequests() () from /usr/lib/x86_64-linux-gnu/libQt5WaylandClient.so.5
#10 0x00007f0bd18b3550 in doActivate<false> (sender=0x557027e0c1b0, signal_index=3, argv=0x7ffef3f49cb0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:395
#11 0x00007f0bd18adaf7 in QMetaObject::activate (sender=sender@entry=0x557027e0c1b0, m=m@entry=0x7f0bd1b59ba0 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffef3f49cb0) at kernel/qobject.cpp:3930
#12 0x00007f0bd18b6d95 in QSocketNotifier::activated (this=this@entry=0x557027e0c1b0, _t1=<optimized out>, _t2=...) at .moc/moc_qsocketnotifier.cpp:141
#13 0x00007f0bd18b70f1 in QSocketNotifier::event (this=0x557027e0c1b0, e=0x7ffef3f49f70) at kernel/qsocketnotifier.cpp:266
#14 0x00007f0bd2462cc3 in QApplicationPrivate::notify_helper (this=this@entry=0x557027d900f0, receiver=receiver@entry=0x557027e0c1b0, e=e@entry=0x7ffef3f49f70) at kernel/qapplication.cpp:3685
#15 0x00007f0bd246bf40 in QApplication::notify (this=0x7ffef3f4a2f0, receiver=0x557027e0c1b0, e=0x7ffef3f49f70) at kernel/qapplication.cpp:3431
#16 0x00007f0bd187d78a in QCoreApplication::notifyInternal2 (receiver=0x557027e0c1b0, event=0x7ffef3f49f70) at ../../include/QtCore/../../src/corelib/kernel/qobject.h:153
#17 0x00007f0bd18d6de5 in socketNotifierSourceDispatch (source=0x557027dc34d0) at kernel/qeventdispatcher_glib.cpp:107
#18 0x00007f0bcf41bfbd in g_main_context_dispatch () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007f0bcf41c240 in ?? () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007f0bcf41c2e3 in g_main_context_iteration () from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00007f0bd18d61e2 in QEventDispatcherGlib::processEvents (this=0x557027e0be80, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#22 0x00007f0bd187c24b in QEventLoop::exec (this=this@entry=0x7ffef3f4a180, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:136
#23 0x00007f0bd1884296 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:118
#24 0x0000557026bf1d11 in ?? ()
#25 0x00007f0bd10db0b3 in __libc_start_main (main=0x557026bf0010, argc=3, argv=0x7ffef3f4a468, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffef3f4a458) at ../csu/libc-start.c:308
#26 0x0000557026bf29ce in ?? ()
[Inferior 1 (process 508358) detached]

Possible duplicates by query: bug 424911, bug 423951, bug 423222, bug 423132, bug 422433.

Reported using DrKonqi
Comment 1 Albert Astals Cid 2020-09-05 07:58:58 UTC
if you start it from  a terminal, i think it should output an error message just before crashing, can you post it here?
Comment 2 Jason Playne 2020-09-05 11:28:18 UTC
Hi Albert,

To trigger this error, I run kpat from the CLI resize the window. 

$ kpat
kf.coreaddons: "2552-1318-background" is too large to be cached.
kf.coreaddons: "2552-1308-background" is too large to be cached.
kf.coreaddons: "2552-1212-background" is too large to be cached.
The Wayland connection broke. Did the Wayland compositor die?
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kpat path = /usr/games pid = 690340
KCrash: Arguments: /usr/games/kpat
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi

[1]+  Stopped                 kpat



The gap in the second one is when I was resizing the window to make it crash


$ kpat
kf.coreaddons: "2552-1318-background" is too large to be cached.





kf.coreaddons: "2552-1308-background" is too large to be cached.
kf.coreaddons: Unable to free up memory for "2552-1134-background"
The Wayland connection broke. Did the Wayland compositor die?
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kpat path = /usr/games pid = 690992
KCrash: Arguments: /usr/games/kpat
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi
Comment 3 Jason Playne 2020-09-05 11:31:56 UTC
For Reference, This is the output doing the same sort of thing under an X11 plasma5 session


$ kpat
kf.coreaddons: "2552-1318-background" is too large to be cached.
kf.coreaddons: "2560-1322-background" is too large to be cached.
kf.coreaddons: Unable to free up memory for "1925-819-background"

(but it did not crash)
Comment 4 Albert Astals Cid 2020-09-05 11:40:17 UTC
Meven, can you find someone from the Wayland effort to help us here?
Comment 5 Aleix Pol 2020-09-20 23:27:43 UTC
I just tried it and I cannot reproduce.

Tried the flatpak version (Qt 5.15.1). @Jason, maybe you can try it with the flatpak as well which is using the latest stable Qt?
Comment 6 Neal Gompa 2020-09-20 23:34:39 UTC
I cannot reproduce this on Fedora 32 (Qt 5.14.2; KF5 5.70.0; Plasma 5.18) and Fedora 33 (Qt 5.15.1; KF5 5.73.0; Plasma 5.19.5). Resizing the window is chunky and sluggish, but it works fine and does not crash.
Comment 7 Neal Gompa 2020-09-20 23:39:20 UTC
Actually scratch that, I *just* managed to reproduce this. It took a few times to resize it to make it happen.
Comment 8 Neal Gompa 2020-09-20 23:41:53 UTC
Reproducer to trigger the crash:

1. Open kpat
2. Select FreeCell
3. Change theme to desert sands and egyptian theme for game and cards
4. Resize from the corner a couple of times

It slows down and eventually freezes and crashes after 4-5 resize attempts.
Comment 9 Neal Gompa 2020-09-20 23:44:40 UTC
Created attachment 131817 [details]
New crash information added by DrKonqi

kpat (19.12.1) using Qt 5.14.2

- What I was doing when the application crashed:
Resizing the application window to be larger from the bottom right corner.
- Custom settings of the application:
  + Ancient Egyptians card deck
  + Desert Sands game theme

-- Backtrace (Reduced):
#6  0x00007f0b965e5a7f in QMessageLogger::fatal(char const*, ...) const () from /lib64/libQt5Core.so.5
#8  0x00007f0b849700f9 in QtWaylandClient::QWaylandShmBackingStore::resize(QSize const&) () from /lib64/libQt5WaylandClient.so.5
#9  0x00007f0b8497035d in QtWaylandClient::QWaylandShmBackingStore::beginPaint(QRegion const&) () from /lib64/libQt5WaylandClient.so.5
#10 0x00007f0b96d3ddad in QBackingStore::beginPaint(QRegion const&) () from /lib64/libQt5Gui.so.5
#11 0x00007f0b9721ce0e in QWidgetRepaintManager::paintAndFlush() () from /lib64/libQt5Widgets.so.5
Comment 10 Neal Gompa 2020-09-21 00:27:21 UTC
Created attachment 131818 [details]
New crash information added by DrKonqi

kpat (20.04.3) using Qt 5.15.1

- What I was doing when the application crashed:
Resizing the application window to be larger from the bottom right corner
- Custom settings of the application:
  + Ancient Egyptians card deck
  + Desert Sands game theme

-- Backtrace (Reduced):
#4  0x00007f809776d003 in KSharedDataCache::Private::CacheLocker::cautiousLock() () from /lib64/libKF5CoreAddons.so.5
#5  0x00007f809776e533 in KSharedDataCache::find(QString const&, QByteArray*) const () from /lib64/libKF5CoreAddons.so.5
#6  0x00007f8097ad561b in KAbstractCardDeck::cardPixmap(unsigned int, bool) () from /lib64/libkcardgame.so
#7  0x00007f8097ad5a4e in KCard::paint(QPainter*, QStyleOptionGraphicsItem const*, QWidget*) () from /lib64/libkcardgame.so
#8  0x00007f809734e8bf in QGraphicsScenePrivate::draw(QGraphicsItem*, QPainter*, QTransform const*, QTransform const*, QRegion*, QWidget*, double, QTransform const*, bool, bool) () from /lib64/libQt5Widgets.so.5
Comment 11 Jason Playne 2020-09-21 00:58:16 UTC
For me it still crashes.

Using neons current build, the flathub version and the kdeapps (flatpak) version all crash.

the time it takes to crash seems variable. sometimes it is nearly instant, others takes a while.

I get feeling that the larger the screen the more likely the crash (I have a 2k monitor, I feel that when the window is larger the crash comes quicker).

When I get the crash, I also get an artefact on the screen, it's ~50% opaque copy of the window that is not selectable.


For me, to reproduce it this time. 
* open kpat (any source, either cli or launcher)
* grab a corner and resize (really shake the mouse around)
*
* profit!

I grabbed an strace of the neon version too
Comment 12 Jason Playne 2020-09-21 00:59:00 UTC
Created attachment 131819 [details]
strace of kpat crashing
Comment 13 Jason Playne 2020-09-21 01:00:21 UTC
As an aside, when I captured the first strace in konsole, I went to select the whole text - and konsole crashed. - not sure if related or not
Comment 14 Méven Car 2020-09-22 07:37:34 UTC
I did reproduce a crash after a while trying just like Neal in https://bugs.kde.org/show_bug.cgi?id=426200#c9 with the same stack trace.
According to the stack trace this crash occurs when kpat draws itself and tries to get a card pixmap, searches the shm cache, where the crash happen in 
KSharedDataCache:

    bool lock() const
    {
        if (Q_LIKELY(shm && shm->shmLock.type == m_expectedType)) {
            return m_lock->lock(); // crash happens here
        }

And there is a different crash relating to Wayland but that is harder to reproduce and made less obvious by the first one.
Comment 15 Nate Graham 2021-01-13 18:44:50 UTC
#6  QMessageLogger::fatal (this=this@entry=0x7fffd70c5ba0, msg=msg@entry=0x7ff994ac00b8 "The Wayland connection broke. Did the Wayland compositor die?") at global/qlogging.cpp:893

This means that the compositor crashed. Due to a Qt issue, when this happens, the app using it will crash too. KDE developers submitted a fix, but sadly it was not merged. See https://codereview.qt-project.org/c/qt/qtwayland/+/308984.

Until we get better handling of this in Qt, the best we can do is debug why the compositor crashed in the first place. So can you please get a backtrace of the crash in kwin_wayland and then file a new bug report with it on kwin | wayland-generic? Thanks!

You may be able to use the `coredumpctl` utility to retrieve the backtrace. See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports#Retrieving_a_backtrace_using_coredumpctl