Bug 483013 - kpat freezes when canceling cards dealing
Summary: kpat freezes when canceling cards dealing
Status: RESOLVED FIXED
Alias: None
Product: kpat
Classification: Applications
Component: general (other bugs)
Version First Reported In: 24.02.0
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords: qt6
: 484059 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-03-09 18:21 UTC by maxlefou
Modified: 2024-03-21 22:37 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description maxlefou 2024-03-09 18:21:10 UTC
SUMMARY
kpat randomly freeze to crash when canceling actions. It's more frequent when you draw a bunch of cards, do some action then cancel them. It then freezes when attempting to cancel the bunch of cards dealing.

STEPS TO REPRODUCE
1. Start a game of Grand Father (Spider does it too. haven't tried on other ones)
2. draw a bunch of cards (with R or by clicking)
3. do some other small card actions
4. cancel all the actions

OBSERVED RESULT
When reaching the part when the bunch of cards are drawn, the whole program freezes.

EXPECTED RESULT
The cancel should happen like it used to do in older versions.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Zen kernel (also noticed in LTS) using X11
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2

ADDITIONAL INFORMATION
Here's what i could get with gdb:
[New Thread 0x7fffdfe006c0 (LWP 28774)]                                                                                                                                   
[New Thread 0x7fffdf4006c0 (LWP 28775)]
[New Thread 0x7fffdea006c0 (LWP 28776)]
[New Thread 0x7fffde0006c0 (LWP 28777)]
[New Thread 0x7fffdd6006c0 (LWP 28778)]
[New Thread 0x7fffdcc006c0 (LWP 28779)]
QFont::setPixelSize: Pixel size <= 0 (0)
[New Thread 0x7fffd74006c0 (LWP 28780)]
[New Thread 0x7fffd66006c0 (LWP 28788)]
[Thread 0x7fffd66006c0 (LWP 28788) exited]
[New Thread 0x7fffd66006c0 (LWP 28799)]
[Thread 0x7fffd66006c0 (LWP 28799) exited]
[New Thread 0x7fffd66006c0 (LWP 28803)]
[Thread 0x7fffd66006c0 (LWP 28803) exited]
[New Thread 0x7fffd66006c0 (LWP 28804)]
[Thread 0x7fffd66006c0 (LWP 28804) exited]
[New Thread 0x7fffd66006c0 (LWP 28805)]
[Thread 0x7fffd66006c0 (LWP 28805) exited]
[New Thread 0x7fffd66006c0 (LWP 28806)]
[Thread 0x7fffd66006c0 (LWP 28806) exited]
free(): invalid next size (fast)

Thread 1 "kpat" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
Downloading source file /usr/src/debug/glibc/glibc/nptl/pthread_kill.c
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;  

Sorry if it has been posted already. I did a search and haven't found anything like it.
Comment 1 Albert Astals Cid 2024-03-10 23:40:13 UTC
Can you do the same in kpat but when that happens type

bt

so we get a full backtrace and not just that one line?
Comment 2 maxlefou 2024-03-11 09:28:30 UTC
thanks. I'm trying but there's something really wrong, now... When it happens, no crash is reported. It hangs but doesn't say anything like if it was running properly... And then of course bt can't do much...  kwin got an update as well as some other kde related packages, maybe that's related... 

Now i don't know what much i can do. Isn't there any other way to get logs? journald doesn't report anything either :(
Comment 3 maxlefou 2024-03-13 11:36:09 UTC
For some reason, gdb is working again (probably an update helped?) and i could get the backtrace. here it is below:

#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007ffff5aab393 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007ffff5a5a6c8 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007ffff5a424b8 in __GI_abort () at abort.c:79
#4  0x00007ffff5a43395 in __libc_message_impl (fmt=fmt@entry=0x7ffff5bbb2ea "%s\n") at ../sysdeps/posix/libc_fatal.c:132
#5  0x00007ffff5ab52a7 in malloc_printerr (str=str@entry=0x7ffff5bb9152 "realloc(): invalid next size") at malloc.c:5772
#6  0x00007ffff5ab934c in _int_realloc (av=av@entry=0x7ffff5bf6ac0 <main_arena>, oldp=oldp@entry=0x5555568e00b0, oldsize=oldsize@entry=64, nb=nb@entry=144)
    at malloc.c:4939
#7  0x00007ffff5aba1a6 in __GI___libc_realloc (oldmem=0x5555568e00c0, bytes=128) at malloc.c:3517
#8  0x00007ffff622e4e8 in QArrayData::reallocateUnaligned
    (data=<optimized out>, dataPointer=<optimized out>, objectSize=objectSize@entry=8, capacity=<optimized out>, option=option@entry=QArrayData::Grow)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/tools/qarraydata.cpp:220
#9  0x00007ffff7c95d5c in QTypedArrayData<KCard*>::reallocateUnaligned
    (option=QArrayData::Grow, capacity=<optimized out>, dataPointer=<optimized out>, data=<optimized out>) at /usr/include/qt6/QtCore/qarraydata.h:118
#10 QtPrivate::QPodArrayOps<KCard*>::reallocate (option=QArrayData::Grow, alloc=<optimized out>, this=0x555556806a98) at /usr/include/qt6/QtCore/qarraydataops.h:295
#11 QArrayDataPointer<KCard*>::reallocateAndGrow(QArrayData::GrowthPosition, long long, QArrayDataPointer<KCard*>*) [clone .constprop.0]
    (this=this@entry=0x555556806a98, where=where@entry=QArrayData::GrowsAtEnd, n=n@entry=1, old=0x0) at /usr/include/qt6/QtCore/qarraydatapointer.h:217
#12 0x00007ffff7c793b0 in QArrayDataPointer<KCard*>::detachAndGrow
    (n=<optimized out>, data=<optimized out>, old=<optimized out>, where=<optimized out>, this=<optimized out>) at /usr/include/qt6/QtCore/qarraydatapointer.h:203
#13 QtPrivate::QPodArrayOps<KCard*>::emplace<KCard*&> (this=0x555556806a98, i=3) at /usr/include/qt6/QtCore/qarraydataops.h:176
#14 0x00007ffff7c8418b in QList<KCard*>::emplace<KCard*&> (i=3, this=0x555556806a98) at /usr/include/qt6/QtCore/qlist.h:866
#15 QList<KCard*>::insert (t=<optimized out>, i=3, this=0x555556806a98) at /usr/include/qt6/QtCore/qlist.h:472
#16 KCardPile::insert (this=0x5555568067f0, index=3, card=0x555556ace140) at /usr/src/debug/kpat/kpat-24.02.0/src/libkcardgame/kcardpile.cpp:384
--Type <RET> for more, q to quit, c to continue without paging--
#17 0x000055555557acbc in operator() (__closure=__closure@entry=0x7fffffffcf80, change=...) at /usr/src/debug/kpat/kpat-24.02.0/src/dealer.cpp:1084
#18 0x000055555557fe19 in DealerScene::undoOrRedo (this=0x555557197940, undo=<optimized out>) at /usr/src/debug/kpat/kpat-24.02.0/src/dealer.cpp:1098
#19 0x00007ffff6190ca9 in QtPrivate::QSlotObjectBase::call
    (a=0x7fffffffd120, r=0x555555a1de10, this=0x555555f4e9b0, this=<optimized out>, r=<optimized out>, a=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobjectdefs_impl.h:433
#20 doActivate<false> (sender=0x555555f4dcf0, signal_index=7, argv=0x7fffffffd120)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qobject.cpp:4039
#21 0x00007ffff6ae2077 in QAction::triggered (_t1=<optimized out>, this=0x555555f4dcf0) at /usr/src/debug/qt6-base/build/src/gui/Gui_autogen/include/moc_qaction.cpp:642
#22 QAction::activate (this=0x555555f4dcf0, event=<optimized out>) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/gui/kernel/qaction.cpp:1102
#23 0x00007ffff71feb1c in QAbstractButtonPrivate::click (this=0x555555fb7fc0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qabstractbutton.cpp:362
#24 0x00007ffff720d245 in QAbstractButton::mouseReleaseEvent (this=0x555555ee91c0, e=0x7fffffffd6b0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qabstractbutton.cpp:974
#25 0x00007ffff731f6fe in QToolButton::mouseReleaseEvent (this=<optimized out>, e=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/widgets/qtoolbutton.cpp:584
#26 0x00007ffff7145065 in QWidget::event (this=0x555555ee91c0, event=0x7fffffffd6b0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qwidget.cpp:8959
#27 0x00007ffff70f438b in QApplicationPrivate::notify_helper (this=this@entry=0x55555576f7b0, receiver=receiver@entry=0x555555ee91c0, e=e@entry=0x7fffffffd6b0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:3296
#28 0x00007ffff70f6be8 in QApplication::notify (this=<optimized out>, receiver=0x555555ee91c0, e=0x7fffffffd6b0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:2782
#29 0x00007ffff6139818 in QCoreApplication::notifyInternal2 (receiver=0x555555ee91c0, event=0x7fffffffd6b0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1121
#30 0x00007ffff613986d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1553
#31 0x00007ffff70f2327 in QApplicationPrivate::sendMouseEvent
    (receiver=0x555555ee91c0, event=0x7fffffffd6b0, alienWidget=0x555555ee91c0, nativeWidget=0x555555a1de10, buttonDown=<optimized out>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:2366
#32 0x00007ffff7157a97 in QWidgetWindow::handleMouseEvent (this=0x555555ea23d0, event=event@entry=0x7fffffffda20)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qwidgetwindow.cpp:653
#33 0x00007ffff7158db0 in QWidgetWindow::event (this=0x555555ea23d0, event=0x7fffffffda20)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qwidgetwindow.cpp:267
#34 0x00007ffff70f438b in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x555555ea23d0, e=0x7fffffffda20)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:3296
#35 0x00007ffff6139818 in QCoreApplication::notifyInternal2 (receiver=0x555555ea23d0, event=0x7fffffffda20)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1121
#36 0x00007ffff613986d in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qcoreapplication.cpp:1553
#37 0x00007ffff676f9e5 in QGuiApplicationPrivate::processMouseEvent (e=0x7fffac001090)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/gui/kernel/qguiapplication.cpp:2325
#38 0x00007ffff67da85c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/gui/kernel/qwindowsysteminterface.cpp:1109
#39 0x00007ffff0023bdf in xcbSourceDispatch (source=<optimized out>)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:57
#40 0x00007ffff4644f69 in g_main_dispatch (context=0x7fffe8000ef0) at ../glib/glib/gmain.c:3476
#41 0x00007ffff46a33a7 in g_main_context_dispatch_unlocked (context=0x7fffe8000ef0) at ../glib/glib/gmain.c:4284
#42 g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7fffe8000ef0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>)
    at ../glib/glib/gmain.c:4349
#43 0x00007ffff4643162 in g_main_context_iteration (context=0x7fffe8000ef0, may_block=1) at ../glib/glib/gmain.c:4414
#44 0x00007ffff63739c4 in QEventDispatcherGlib::processEvents (this=0x5555557e05d0, flags=...)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventdispatcher_glib.cpp:393
#45 0x00007ffff6143d6e in QEventLoop::processEvents (flags=..., this=0x7fffffffdee0)
    at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventloop.cpp:100
#46 QEventLoop::exec (this=0x7fffffffdee0, flags=...) at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/kernel/qeventloop.cpp:182
#47 0x00007ffff613c2b8 in QCoreApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/corelib/global/qflags.h:74
#48 0x00007ffff70f0f0a in QApplication::exec () at /usr/src/debug/qt6-base/qtbase-everywhere-src-6.6.2/src/widgets/kernel/qapplication.cpp:2574
#49 0x000055555557234d in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kpat/kpat-24.02.0/src/main.cpp:344
Comment 4 Albert Astals Cid 2024-03-13 22:10:58 UTC
What do you mean by "cancel"? You mean undo?
Comment 5 Bug Janitor Service 2024-03-13 22:33:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/games/kpat/-/merge_requests/61
Comment 6 maxlefou 2024-03-14 08:13:35 UTC
(In reply to Albert Astals Cid from comment #4)
> What do you mean by "cancel"? You mean undo?

yes, undo. what else? sorry, i'm not english native.
Comment 7 Albert Astals Cid 2024-03-14 21:10:21 UTC
Git commit 66bb932f7f5b6b7377a45b3c731a83de68745658 by Albert Astals Cid.
Committed on 14/03/2024 at 21:08.
Pushed by aacid into branch 'master'.

Fix crash on undo

This reverts ad71e6a8e644d1061c31a72b1f5375344d37a20a
which was a previous attempt of fixing crash on undo

M  +1    -11   src/dealer.cpp
M  +6    -1    src/libkcardgame/kcardpile.cpp

https://invent.kde.org/games/kpat/-/commit/66bb932f7f5b6b7377a45b3c731a83de68745658
Comment 8 Albert Astals Cid 2024-03-14 21:11:51 UTC
Git commit c13efb2acf3f296830d26a9e747768762c97e84b by Albert Astals Cid.
Committed on 14/03/2024 at 21:11.
Pushed by aacid into branch 'release/24.02'.

Fix crash on undo

This reverts ad71e6a8e644d1061c31a72b1f5375344d37a20a
which was a previous attempt of fixing crash on undo
(cherry picked from commit 66bb932f7f5b6b7377a45b3c731a83de68745658)

M  +1    -11   src/dealer.cpp
M  +6    -1    src/libkcardgame/kcardpile.cpp

https://invent.kde.org/games/kpat/-/commit/c13efb2acf3f296830d26a9e747768762c97e84b
Comment 9 Albert Astals Cid 2024-03-21 22:37:17 UTC
*** Bug 484059 has been marked as a duplicate of this bug. ***