Bug 349481

Summary: konsole session sometimes is not saved into ~/.config/ksmserverrc on logout
Product: [Applications] konsole Reporter: Roland Pallai <dap78>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal CC: ag+services, ahartmetz, alex.danila.web, cpigat242, daniel, edward.lara.lara, ghborrmann, ldj00, linuxfluesterer, loic.yhuel, oecetinel, rdieter, rivaldi8, wolfram.koehn, zilla, zmogas
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Roland Pallai 2015-06-22 00:34:33 UTC
I have "restore previous session" enabled and works well except for konsole. Konsole session is not saved into ~/.config/ksmserverrc on 50% of logouts. I think it's konsole-specific, other kde and non-kde apps are always saved (and restored on login). I think there is more chance to hit the bug if more windows are open at logout.

It's always saved at manual session save (into section "[Session: saved by user]").


Reproducible: Sometimes

Steps to Reproduce:
1. login, open some konsole and dolphin windows
2. logout
3. check ~/.config/ksmserverrc for "konsole"



Fedora 22;
konsole5-15.04.0-1.fc22.x86_64
plasma-workspace-5.3.1-2.fc22.x86_64
Comment 1 Roland Pallai 2015-06-22 00:49:46 UTC
Konsole always saves their own session file into ~/.config/session/konsole_* even when doesn't get saved by ksmserver. Those konsole_* files stays there forever.
Comment 2 Roland Pallai 2015-06-22 16:43:13 UTC
Easily reproducible on a clean Fedora 22 install in KVM.

I try to dig deeper but it's not an easy topic for a newbie on KDE like me.
Comment 3 Roland Pallai 2015-06-22 23:27:39 UTC
It's not konsole-specific: kwite also affected.

Seems like app window closes before ksmserver could store the session. I hooked a breakpoint on "QGuiApplicationPrivate::saveState()" in Konsole and found that all windows are already gone when it stops on this breakpoint. This is not normal.
Comment 4 Roland Pallai 2015-06-23 01:27:57 UTC
Those who rely heavily on Konsole and session management (like me), there is a simple workaround on Fedora 22: use Konsole 4.x - seems like only KF5/Qt5 applications are affected.

# dnf remove konsole5; dnf install konsole
Comment 5 Wolfram Köhn 2015-06-23 06:41:25 UTC
Could it be related to this: Bug 346768 ?
Comment 6 Loïc Yhuel 2015-06-25 22:27:17 UTC
I have the issue too :
 - files accumulate in ~/.config/session (I can see the last ksonsole/kate sessions)
 - ~/.config/ksmserverrc doesn't list all applications (I see kwin_x11, kmix, firewall_applet, sometimes pulseaudio)

Manually saving the session works.
Comment 7 ghborrmann 2015-07-01 20:44:18 UTC
I also show this behavior.  With 3 konsole windows on two desktops, and a konqueror session on the third, only the konqueror session is restored upon login.  Manually saving the session does not work perfectly for me -- the exact opposite occurs: the konsole windows are all restored, but the konqueror session does not appear.
Comment 8 Ömer 2015-07-03 18:15:35 UTC
I have following behavior:
-Auto-save session everything except KF5 Konsole is restored
-Tried save manually session and this works as expected

Btw i am using kwin with the fix from this bug report https://bugs.kde.org/show_bug.cgi?id=341930

The only thing not working properly is discarding the last session files for kwin the others are deleted as they should be.
The "discardCommand" entry in ksmserverrc is missing for kwin completely. (also the counting is strange "discardCommand3, discardCommand5,discardCommand6,discardCommand7" where did 1,2 and 4 go?^^)
Comment 9 Alex Dănilă 2015-10-29 21:18:32 UTC
I confirm this for Debian, both Testing and Unstable, and has been like this for a while. Most or all other programs are restored properly.

Version 15.08.0
Using:
KDE Frameworks 5.15.0
Qt 5.5.1 (built against 5.4.2)
The xcb windowing system
Comment 10 Andreas Hartmetz 2015-11-23 01:46:57 UTC
Probably an instance of bug 354724
After I hacked konsole to not quit on session saving, it didn't restore properly on restore... that seems to be a separate bug.
On my computers the bug happens every time, but it is timing dependent so may trigger randomly for others. If konsole dies before kmserver saves the list of applications to restore, konsole will not be restored. If it dies later, it will be restored.
Comment 11 linuxfluesterer 2016-04-03 14:20:26 UTC
Hmm, I already use Plasma 5.6.1 as date of 29/03/2016. The above BUG is still given for KDE/Plasma specific applicatitions like Konsole, KWrite, Settings and so on.
To relogin to a saved session (last session) was a fine thing in KDE 4.x, because it worked.
Is there any try, any work to solve this bug in close future.
I would be glad about.
Thank you...
Comment 12 Andreas Hartmetz 2016-04-05 12:20:42 UTC
(In reply to linuxfluesterer from comment #11)
> Hmm, I already use Plasma 5.6.1 as date of 29/03/2016. The above BUG is
> still given for KDE/Plasma specific applicatitions like Konsole, KWrite,
> Settings and so on.
> To relogin to a saved session (last session) was a fine thing in KDE 4.x,
> because it worked.
> Is there any try, any work to solve this bug in close future.
> I would be glad about.
> Thank you...

Your KDE stack needs to be compiled against Qt 5.6 to fix this. This is hard to change without compiling KDE yourself. Even installing Qt 5.6 won't help.
Comment 13 linuxfluesterer 2016-04-07 10:30:31 UTC
(In reply to Andreas Hartmetz from comment #12)
> (In reply to linuxfluesterer from comment #11)
> > Hmm, I already use Plasma 5.6.1 as date of 29/03/2016. The above BUG is
> > still given for KDE/Plasma specific applicatitions like Konsole, KWrite,
> > Settings and so on.
> > To relogin to a saved session (last session) was a fine thing in KDE 4.x,
> > because it worked.
> > Is there any try, any work to solve this bug in close future.
> > I would be glad about.
> > Thank you...
> 
> Your KDE stack needs to be compiled against Qt 5.6 to fix this. This is hard
> to change without compiling KDE yourself. Even installing Qt 5.6 won't help.

So then... is there any plan, any schedule to compile KDE by the developers?
If not, could I compile complete KDE packages (Plasma 5.6 Meta packages maybe) by using Gentoo and the 'emerge' command?
I'm a Sabayon user. Sabayon is a rolling release and offers precompiled binaries.
Thank you.
Comment 14 Andreas Hartmetz 2016-04-07 11:59:42 UTC
(In reply to linuxfluesterer from comment #13)
> (In reply to Andreas Hartmetz from comment #12)
> > (In reply to linuxfluesterer from comment #11)
> > > Hmm, I already use Plasma 5.6.1 as date of 29/03/2016. The above BUG is
> > > still given for KDE/Plasma specific applicatitions like Konsole, KWrite,
> > > Settings and so on.
> > > To relogin to a saved session (last session) was a fine thing in KDE 4.x,
> > > because it worked.
> > > Is there any try, any work to solve this bug in close future.
> > > I would be glad about.
> > > Thank you...
> > 
> > Your KDE stack needs to be compiled against Qt 5.6 to fix this. This is hard
> > to change without compiling KDE yourself. Even installing Qt 5.6 won't help.
> 
> So then... is there any plan, any schedule to compile KDE by the developers?
> If not, could I compile complete KDE packages (Plasma 5.6 Meta packages
> maybe) by using Gentoo and the 'emerge' command?
> I'm a Sabayon user. Sabayon is a rolling release and offers precompiled
> binaries.
> Thank you.

We don't ship compiled packages, distributions do. They could also backport the necessary changes in Qt and remove the Qt version check in KDE.
If you use Gentoo, sure, you can compile your own and get those changes. But I do not know whether they are already in (your) stable versions of Frameworks 5 and Plasma and applications (where necessary). I haven't done much else for KDE recently, so if you see my name in the commit logs of kdelibs4support, kxmlgui and plasma-workspace in those versions, you have recent enough versions. The commit message should be about "fallback session management".
Comment 15 Rex Dieter 2016-04-07 12:55:50 UTC
I'm skeptical of the claim that a full rebuild is required, are you suggesting that qt-5.6.x introduced some abi change wrt session-management?  If so, what evidence do you have for that claim?
Comment 16 Andreas Hartmetz 2016-04-07 13:27:09 UTC
(In reply to Rex Dieter from comment #15)
> I'm skeptical of the claim that a full rebuild is required, are you
> suggesting that qt-5.6.x introduced some abi change wrt session-management? 
> If so, what evidence do you have for that claim?

5.6.0 introduced new API that is unfortunately required to fix the bug. That's of course also an ABI change. Evidence: commit e7bf0edfd49de9a4d8285fbe8d878f8fda910e6d in qtbase.
Comment 17 Rex Dieter 2016-04-07 13:31:45 UTC
So it's at least an API change, but not necessarily an ABI change

Do you know which kf5/plasma components use this new API?  (only those would need rebuilding, not the entire stack)
Comment 19 Andreas Hartmetz 2016-04-07 14:17:07 UTC
I meant ABI change in the sense that if something is compiled against the new API, it won't run against an older version.
Applications that use KMainWindow (from kxmlgui framework) or KApplication (from kdelibs4support framework) are fixed automatically. Others all need to be fixed separately ("disable fallback session management").
Comment 20 Rex Dieter 2016-04-07 14:21:50 UTC
OK, that's not the classic definition (at least what I meant) of ABI change/break.  ABI break, to me, means a new build is no longer backward compatible.
Comment 21 Roland Pallai 2016-05-19 23:54:19 UTC
For the record: it is fixed in Fedora 24. Thank you!