Bug 492971

Summary: Konsole sometimes fails to restore state during session restore
Product: [Applications] konsole Reporter: Kevin Wolf <kwolf>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: 24.08.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Kevin Wolf 2024-09-11 08:20:41 UTC
SUMMARY
I usually have two Konsole windows with multiple tabs in different working directories open. I've enabled session restore so that I would get the same two windows and their tabs with the right working directory back when I login the next day. Usually this works, but sometimes I only get two Konsole windows with just a single tab each and my home directory as the current working directory, as would be the case if Konsole is started without loading any state.

STEPS TO REPRODUCE
1. Enable session restore (restore last session)
2. Open a Konsole window (or multiple, two in my case), open several tabs in it and change their working directory
3. Shut down the computer (I suppose logging out would be enough, but that's not usually what I do)
4. Start the computer again and log in
5. If the problem didn't reproduce, goto 3.

OBSERVED RESULT
Sometimes on session restore (maybe ~10% of cases?) I get Konsole windows with only a single tab and my home directory as the current working directory, as would be the case if Konsole is started without loading any state.

EXPECTED RESULT
I should get back all Konsole windows with the previous number of tabs, and each tab in the same working directory as it was when I logged out.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 6.1.4
KDE Frameworks Version: 6.5.0
Qt Version: 6.7.2
Graphics Platform: X11

konsole-24.08.0-1.fc40.x86_64

ADDITIONAL INFORMATION
This happened when I logged in today. When checking journalctl, it contains some errors referring to Konsole both on logout yesterday and on the login today. I checked earlier logs where the problem didn't occur and these messages don't seem to appear there.

Errors on logout (interestingly, there is a "Stopping" line only for one instance, but a "Stopped" one for both - after session restore, both didn't load their state, though):

Sep 10 19:50:13 merkur systemd[4178]: Stopping app-org.kde.konsole@9a4be44ea60b43cd8fa7699ab7cbcf87.service - Konsole - Terminal...
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service, ignoring: Operation not permitted
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 11574 (dbus-launch) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 12392 (sd_espeak-ng-mb) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 12395 (sd_espeak-ng) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 12398 (sd_dummy) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 12401 (speech-dispatch) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service, ignoring: Operation not permitted
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service, ignoring: Operation not permitted
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 11574 (dbus-launch) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 12392 (sd_espeak-ng-mb) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 12395 (sd_espeak-ng) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 12398 (sd_dummy) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Killing process 12401 (speech-dispatch) with signal SIGKILL.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service, ignoring: Operation not permitted
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Unit process 11574 (dbus-launch) remains running after unit stopped.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Unit process 12392 (sd_espeak-ng-mb) remains running after unit stopped.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Unit process 12395 (sd_espeak-ng) remains running after unit stopped.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Unit process 12398 (sd_dummy) remains running after unit stopped.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Unit process 12401 (speech-dispatch) remains running after unit stopped.
Sep 10 19:50:13 merkur systemd[4178]: Stopped app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service - Konsole - Terminal.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@b7fdd265574b400fab512fc41efc86d4.service: Consumed 3h 12min 43.196s CPU time, 4.4G memory peak, 0B memory swap peak.
Sep 10 19:50:13 merkur systemd[4178]: Stopped app-org.kde.konsole@9a4be44ea60b43cd8fa7699ab7cbcf87.service - Konsole - Terminal.
Sep 10 19:50:13 merkur systemd[4178]: app-org.kde.konsole@9a4be44ea60b43cd8fa7699ab7cbcf87.service: Consumed 3min 29.877s CPU time, 2.4G memory peak, 0B memory swap peak.

Errors on login:

Sep 11 09:30:36 merkur systemd[3202]: Started app-org.kde.konsole@3070d2f9d6f240f296d5126e4d8730af.service - Konsole - Terminal.
Sep 11 09:30:36 merkur systemd[3202]: Started app-org.kde.konsole@32d20f88ba124472b1d9f28a4835ca5d.service - Konsole - Terminal.
Sep 11 09:30:36 merkur konsole[5002]: Qt: Session management error: Authentication Rejected, reason : MIT-MAGIC-COOKIE-1 authentication rejected
Sep 11 09:30:36 merkur konsole[5000]: Qt: Session management error: Authentication Rejected, reason : MIT-MAGIC-COOKIE-1 authentication rejected