Causes of session management problems in Plasma 5

Andreas Hartmetz ahartmetz at
Wed Nov 25 23:37:35 GMT 2015

On Mittwoch, 25. November 2015 18:05:26 CET Thomas L├╝bking wrote:
> On Dienstag, 24. November 2015 02:02:46 CEST, Andreas Hartmetz wrote:
> > - The session manager not "locking down" or better copying the list
> > of> 
> >   clients *while* logging out. This would arguably only help buggy
> >   clients, but may still be a net positive.
> It would falsely restore clients that do not want to be restored
> (maybe also because they've gotten some autostart entry)

No, I don't think so. Clients that don't want to be restored don't 
respond to "SaveYourself" with "SaveYourselfDone". More details below.

> >   Why copy the list? Logout may be canceled, so it is valuable to
> >   keep
> >   the main client list updated for after logout cancellation.
> So if I logout, kwrite exits, konsole asks, I cancel, I restart
> kwrite, I logout, kwrite exits, konsole asks, I cancel, I restart
> kwrite, ... I end up with n iterations of kwrite on the restorage?
> Nahhh.... the SM should restore what the user left behind on logout,
> not what he had running in the former session "somewhen" ;-)
I haven't explained all the details.
First, by copy I mean a temporary copy that is never merged back into 
the main list, it's kept around only to know which processes have 
already agreed to have their session saved and submitted the 
corresponding data.
The saved process states are saved in files in ~/.config/session. 
However, those files do nothing if ksmserver doesn't also *restart* the 
respective process, usually with the -session <sessionfile> command-line 
argument. ksmserver only saves the list of processes to restore when 
logout has been "confirmed", which means when nothing can cancel it 
anymore. The list of processes to restore is saved in ~/.config/
ksmserver even has or can have enough data to be able to clean up stale, 
already saved session files when logout is canceled. Currently it leaks 
konsole session files...

The current problem is that some applications die between submitting 
their state to ksmserver (SaveYourselfDone message) and ksmserver saving 
the list of processes to restart (writing ksmserverrc). It is AFAICS 
safe to assume that an application that has submitted its session data 
is really supposed to be restored.

> Other than that, thanks and kudos for the Investigation and get
> QGuiApplication fixed itr. =)
Thanks! Wish me luck :)
It's going to be a behavior change, you know :/

> Cheers,
> Thomas

More information about the kde-core-devel mailing list