Bug 454159

Summary: plasma_session crashes in SessionTrack::~SessionTrack() immediately after login to Wayland session with an external monitor connected to hdmi port and mult-monitor mode set to "Switch to external screen"
Product: [Plasma] plasmashell Reporter: Patrick Silva <bugseforuns>
Component: Startup processAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: fredsemail1230, kde, nate, postix
Priority: NOR Keywords: wayland
Version: master   
Target Milestone: 1.0   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In: 5.25.2
Sentry Crash Report:

Description Patrick Silva 2022-05-21 14:02:18 UTC
SUMMARY
I started Wayland session with an external monitor connected to hdmi port, multi-monitor mode was configured as "Switch to external screen", there was no evident problem with my session but coredumpctl revealed plasma_session crash.


Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.25.80
KDE Frameworks Version: 5.95.0
Qt Version: 5.15.4
Graphics Platform: Wayland


Thread 2 (Thread 0x7f91db3c5700 (LWP 2840)):
#0  0x00007f91e0c8399f in __GI___poll (fds=0x7f91d4005240, nfds=2, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x00007f91de5a436e in g_main_context_poll (priority=<optimized out>, n_fds=2, fds=0x7f91d4005240, timeout=<optimized out>, context=0x7f91d4000c20) at ../../../glib/gmain.c:4346
#2  g_main_context_iterate (context=context@entry=0x7f91d4000c20, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4042
#3  0x00007f91de5a44a3 in g_main_context_iteration (context=0x7f91d4000c20, may_block=may_block@entry=1) at ../../../glib/gmain.c:4108
#4  0x00007f91e13a5c72 in QEventDispatcherGlib::processEvents (this=0x7f91d4000b60, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#5  0x00007f91e1349eab in QEventLoop::exec (this=this@entry=0x7f91db3c4bb0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:141
#6  0x00007f91e1163462 in QThread::exec (this=this@entry=0x7f91e1d5ed80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#7  0x00007f91e1cdaf4b in QDBusConnectionManager::run (this=0x7f91e1d5ed80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at qdbusconnection.cpp:179
#8  0x00007f91e1164643 in QThreadPrivate::start (arg=0x7f91e1d5ed80 <(anonymous namespace)::Q_QGS__q_manager::innerFunction()::holder>) at thread/qthread_unix.cpp:331
#9  0x00007f91defbd609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#10 0x00007f91e0c90133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7f91db93e280 (LWP 2839)):
#0  __GI_raise (sig=sig@entry=11) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f91df38dff5 in KCrash::defaultCrashHandler (sig=11) at ./src/kcrash.cpp:618
#2  <signal handler called>
#3  0x0000564a1b8e9cc0 in ?? ()
#4  0x0000564a19b528cf in SessionTrack::~SessionTrack (this=0x564a1b8e9cc0, __in_chrg=<optimized out>) at ./startkde/plasma-session/sessiontrack.cpp:44
#5  0x0000564a19b5296d in SessionTrack::~SessionTrack (this=0x564a1b8e9cc0, __in_chrg=<optimized out>) at ./startkde/plasma-session/sessiontrack.cpp:33
#6  0x00007f91e1378d23 in QObject::event (this=0x564a1b8e9cc0, e=0x564a1b877b90) at kernel/qobject.cpp:1301
#7  0x00007f91e134b37f in doNotify (event=0x564a1b877b90, receiver=0x564a1b8e9cc0) at ../../include/QtCore/../../src/corelib/kernel/qobject.h:153
#8  QCoreApplication::notify (event=<optimized out>, receiver=<optimized out>, this=<optimized out>) at kernel/qcoreapplication.cpp:1140
#9  QCoreApplication::notifyInternal2 (receiver=0x564a1b8e9cc0, event=0x564a1b877b90) at kernel/qcoreapplication.cpp:1064
#10 0x00007f91e134dcb1 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=52, data=0x564a1b86d460) at kernel/qcoreapplication.cpp:1821
#11 0x00007f91e135206c in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:86
#12 0x0000564a19b4a5b1 in main (argc=<optimized out>, argv=<optimized out>) at ./startkde/plasma-session/main.cpp:16
Comment 1 David Edmundson 2022-06-17 17:20:05 UTC

*** This bug has been marked as a duplicate of bug 454157 ***
Comment 2 Nate Graham 2022-06-17 20:35:36 UTC
*** Bug 454157 has been marked as a duplicate of this bug. ***
Comment 3 Bug Janitor Service 2022-06-20 10:15:50 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1858
Comment 4 Nate Graham 2022-06-25 21:31:53 UTC
Git commit 3692ff7ca4a927960883f737cf9f8e842bb2ee4a by Nate Graham, on behalf of David Edmundson.
Committed on 25/06/2022 at 21:25.
Pushed by ngraham into branch 'master'.

Avoid crash in plasma-session teardown

Whilst iterating through m_proccesses we make them finish. An existing
connect removes them from the vector.

Iterating through a volatile vector is unsafe.

M  +4    -1    startkde/plasma-session/sessiontrack.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/3692ff7ca4a927960883f737cf9f8e842bb2ee4a
Comment 5 Nate Graham 2022-06-25 22:03:56 UTC
Git commit d159d05baab01b01c3524304b11265ebeb665ad1 by Nate Graham, on behalf of David Edmundson.
Committed on 25/06/2022 at 22:03.
Pushed by ngraham into branch 'Plasma/5.25'.

Avoid crash in plasma-session teardown

Whilst iterating through m_proccesses we make them finish. An existing
connect removes them from the vector.

Iterating through a volatile vector is unsafe.


(cherry picked from commit 3692ff7ca4a927960883f737cf9f8e842bb2ee4a)

M  +4    -1    startkde/plasma-session/sessiontrack.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/d159d05baab01b01c3524304b11265ebeb665ad1
Comment 6 Nate Graham 2022-06-27 19:44:27 UTC
*** Bug 455910 has been marked as a duplicate of this bug. ***
Comment 7 Fushan Wen 2022-06-30 04:33:41 UTC
Git commit effe12a06dbdfaa53a3f74c71f03a3dfa1e00de2 by Fushan Wen, on behalf of David Edmundson.
Committed on 30/06/2022 at 04:33.
Pushed by fusionfuture into branch 'Plasma/5.24'.

Avoid crash in plasma-session teardown

Whilst iterating through m_proccesses we make them finish. An existing
connect removes them from the vector.

Iterating through a volatile vector is unsafe.


(cherry picked from commit 3692ff7ca4a927960883f737cf9f8e842bb2ee4a)

M  +4    -1    startkde/plasma-session/sessiontrack.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/effe12a06dbdfaa53a3f74c71f03a3dfa1e00de2