Summary: | kde-plasma/plasma-workspace 5.27.11.1: ksmserver still sometimes fails to save and later restore a session | ||
---|---|---|---|
Product: | [Plasma] plasmashell | Reporter: | i.Dark_Templar <idarktemplar> |
Component: | Session Management | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | imaginator, kde, natalie_clarius, nate, o.freyermuth |
Priority: | NOR | ||
Version: | 6.1.3 | ||
Target Milestone: | 1.0 | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
See Also: |
https://bugs.kde.org/show_bug.cgi?id=490469 https://bugs.kde.org/show_bug.cgi?id=487912 |
||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
i.Dark_Templar
2024-06-15 09:54:53 UTC
Yesterday all applications were restored, but dolphin didn't restore any tabs it had in last session. Today no applications were restored. Still reproduces every couple of boots with plasma 6.1.3. I also observed this mostly randomly, especially if many applications are open, in those cases: ~/.config/ksmserverrc was cut off for me. Using OpenRC here and I am wondering whether the file was cut off due to too fast / unexpected process termination when logging off. I do confirm this for a BLFS-system. [1] X11-sessions are sometimes only partially restored or not at all. Plasma is practically unusable in this state. It's clear that session-restore with patched plasma-workspace-2.27.11.1 is still broken. Besides the errors fixed by the patch some other problem must have been introduced that has not yet been addressed. ------------------ [1] Plasma-5.27.11 QT-5.15.14 FW-5.116.0 (In reply to Oliver Freyermuth from comment #3) > I also observed this mostly randomly, especially if many applications are > open, in those cases: > ~/.config/ksmserverrc > was cut off for me. Using OpenRC here and I am wondering whether the file > was cut off due to too fast / unexpected process termination when logging > off. I doubt that the number of open programs has something to do with it. Even with many programs open (16), session-restore has been working flawlessly here since my last post. I rather suspect that under certain circumstances a mismatch occurs between the files referenced in ~/.config/ksmserverrc and the status-files in ~/.config/session. An incomplete ksmserverrc (if you mean that by "cut off") may indeed be a cause. So if this Heisenbug strikes again a closer look at ksmserverrc and the files in /session may be worthwile. (In reply to imaginator from comment #5) > (In reply to Oliver Freyermuth from comment #3) > I rather suspect that under certain circumstances a mismatch occurs between > the files referenced in ~/.config/ksmserverrc and the status-files in > ~/.config/session. An incomplete ksmserverrc (if you mean that by "cut > off") may indeed be a cause. So if this Heisenbug strikes again a closer > look at ksmserverrc and the files in /session may be worthwile. Yes, in fact I mean "incomplete" when mentioning "cut off", as if the program writing out the file was terminated hard while writing... I had the bug occur again on a system with Plasma 6.1, with wayland this time (but the system also uses openrc, no systemd). Full ksmserverrc: ``` [$Version] update_info=ksmserver_update_loginMode_value.upd:ksmserver_update_loginMode_value_default_enum [General] screenCount=1 [LegacySession: saved at previous logout] count=0 [Session: saved at previous logout] clientId1=10ab6d6731000147059923000000123150016 clientId2=10ab6d6731000172641278200000120020004 count=2 program1=/usr/bin/gkrellm program2=/home/olifre/.dropbox-dist/dropbox-lnx.x86_64-207.4.5821/dropbox restartCommand1=/usr/bin/gkrellm,--sm-client-id,10ab6d6731000147059923000000123150016 restartCommand2=/home/olifre/.dropbox-dist/dropbox-lnx.x86_64-207.4.5821/dropbox,-session,10ab6d6731000172641278200000120020004_1726451308_783776 restartStyleHint1=0 restartStyleHint2=0 userId1=olifre userId2=olifre ``` The session had KeepassXC and some Konsole terminals open when I shut down, but this was not stored in the ksmserverrc. Checking the "session" directory, what should I be looking for? Dropbox and gkrellm don't save any state, and the Konsole sessions were not persisted. I only find one file in the "session" directory matching in time with the last shutdown of the system: ``` -rw------- 1 olifre olifre 10254 16. Sep 03:48 'kwin_saved at previous logout_' ``` Nothing else was saved. (In reply to Oliver Freyermuth from comment #6) > (In reply to imaginator from comment #5) > > (In reply to Oliver Freyermuth from comment #3) > > I rather suspect that under certain circumstances a mismatch occurs between > > the files referenced in ~/.config/ksmserverrc and the status-files in > > ~/.config/session. An incomplete ksmserverrc (if you mean that by "cut > > off") may indeed be a cause. So if this Heisenbug strikes again a closer > > look at ksmserverrc and the files in /session may be worthwile. > > Yes, in fact I mean "incomplete" when mentioning "cut off", as if the > program writing out the file was terminated hard while writing... > > I had the bug occur again on a system with Plasma 6.1, with wayland this > time (but the system also uses openrc, no systemd). Full ksmserverrc: > ``` > [$Version] > update_info=ksmserver_update_loginMode_value.upd: > ksmserver_update_loginMode_value_default_enum > > [General] > screenCount=1 > > [LegacySession: saved at previous logout] > count=0 > > [Session: saved at previous logout] > clientId1=10ab6d6731000147059923000000123150016 > clientId2=10ab6d6731000172641278200000120020004 > count=2 > program1=/usr/bin/gkrellm > program2=/home/olifre/.dropbox-dist/dropbox-lnx.x86_64-207.4.5821/dropbox > restartCommand1=/usr/bin/gkrellm,--sm-client-id, > 10ab6d6731000147059923000000123150016 > restartCommand2=/home/olifre/.dropbox-dist/dropbox-lnx.x86_64-207.4.5821/ > dropbox,-session,10ab6d6731000172641278200000120020004_1726451308_783776 > restartStyleHint1=0 > restartStyleHint2=0 > userId1=olifre > userId2=olifre > ``` > The session had KeepassXC and some Konsole terminals open when I shut down, > but this was not stored in the ksmserverrc. > > Checking the "session" directory, what should I be looking for? Dropbox and > gkrellm don't save any state, and the Konsole sessions were not persisted. I > only find one file in the "session" directory matching in time with the last > shutdown of the system: > ``` > -rw------- 1 olifre olifre 10254 16. Sep 03:48 'kwin_saved at previous > logout_' > ``` > Nothing else was saved. Information on how Plasma's session-restore actually works is hard to come by. The gist of what I've figured out so far: for a successful session-restore there have to be files in ~/.config/session which describe the (KDE-) programs' state at logout and whose ID must match those of the "restartCommand*" in ~/.config/ksmserverrc. The files are created by the programs when a session ends and are used by ksmserver to recreate their state at login. (The files should be purged at logout ("discardCommand*") but that doesn't seem to work consistently.) If either the restart-command in ksmserverrc or the matching file is missing, session-restore for that program will fail. So, according to your observation we should look for both, the restart-command and the matching file. That ksmserverrc was incomplete and the files for Konsole were not created at all is important information and should give KDE-devs enough of a clue already which of the changes in plasma-workspace-5.27.11.1 may cause the problem. Thanks for confirming that this is helpful! Since I encountered this once more, this time on 5.27.11.1 with X11 again, I wanted to add a final dump of the ksmserverrc: ``` [$Version] update_info=ksmserver_update_loginMode_value.upd:ksmserver_update_loginMode_value_default_enum [General] screenCount=1 [LegacySession: saved at previous logout] clientMachine1=localhost clientMachine2=localhost clientMachine3=localhost command1=thunderbird command2=gkrellm command3=firefox count=3 [Session: saved at previous logout] count=0 ``` So "everything" was lost. The session directory, again, only contains a fresh "'kwin_saved at previous logout_'" but nothing else with a matching modification time. So at least in my case, I see this both with 5.27.11 and X11 and 6.1 and Wayland. Note that all my systems use OpenRC, not systemd, in case this is relevant. Sorry for the double post, but this is likely also relevant: I realized that on the 5.27.11.1 system, the shell history was also cut off after 6.8 MB /it is 17 MB large in my case) during the last "session restore failure" boot. I could restore it from a backup, but it looks like the shell was force-killed during session teardown and could not flush the history file (maybe a symptom caused by the same bug?). (In reply to Oliver Freyermuth from comment #9) > Sorry for the double post, but this is likely also relevant: > I realized that on the 5.27.11.1 system, the shell history was also cut off > after 6.8 MB /it is 17 MB large in my case) during the last "session restore > failure" boot. I could restore it from a backup, but it looks like the shell > was force-killed during session teardown and could not flush the history > file (maybe a symptom caused by the same bug?). Maybe, but I can't confirm this. BTW: your .bash_history is rather large. You may try to keep it in check a little with HISTSIZE, HISTIGNORE and HISTCONTROL (-> man bash). |