Bug 400089 - Previously closed PDF's open at startup, accompanied by an error message
Summary: Previously closed PDF's open at startup, accompanied by an error message
Status: RESOLVED WORKSFORME
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: 1.3.3
Platform: Kubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-21 01:11 UTC by dustin.fenster
Modified: 2018-10-23 09:05 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dustin.fenster 2018-10-21 01:11:50 UTC
SUMMARY

Several PDFs which I had been reading during a single session, which were all closed after use, now open upon each restart, accompanied by an error (for each file) saying "Could not open file."  The PDFs are synced to local via a cloud storage service.

STEPS TO REPRODUCE
1. Restart
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE VERSIONS
(available in About System)
KDE Plasma Version: 5.12.6
KDE Frameworks Version: 5.44.0
Qt Version: 5.9.5

ADDITIONAL INFORMATION
Comment 1 Tobias Deiminger 2018-10-21 14:33:56 UTC
Could it be you have "Restore manually saved session" checked in KDE System Settings > Startup and Shutdown > Desktop Session? What you describe sounds like ksmserver is restoring a manually/accidentally saved session, that was saved while okular was running.

Could you open the file ~/.config/ksmserverrc in a text editor and check if it has lines referring to okular? E.g.

restartCommand31=okular,-session,1013f135148e5000154010731700000012941302_1540107347_651405

If so, in which section do those lines appear? Is it below [Session: saved by user]?

Can you also try to restore okular session state manually, by starting okular from command line with the identifier from ksmserverrc as argument, like

$ okular -session 1013f135148e5000154010731700000012941302_1540107347_651405

Do you still get "Could not open file" this way?

Could you also attach the content of the file(s) $HOME/.config/session/okular_<identifier_from_ksmserverrc>? It will contain the URLs for the files being tried to load.
Comment 2 dustin.fenster 2018-10-21 17:54:06 UTC
(In reply to Tobias Deiminger from comment #1)
> Could it be you have "Restore manually saved session" checked in KDE System
> Settings > Startup and Shutdown > Desktop Session? What you describe sounds
> like ksmserver is restoring a manually/accidentally saved session, that was
> saved while okular was running.

"restore previous session" is checked and "restore manually saved session" is not.  

> 
> Could you open the file ~/.config/ksmserverrc in a text editor and check if
> it has lines referring to okular? E.g.
> 
> restartCommand31=okular,-session,
> 1013f135148e5000154010731700000012941302_1540107347_651405
> 
> If so, in which section do those lines appear? Is it below [Session: saved
> by user]?
> 

There are several such lines, however I don't see a [Session: saved by user] section; they are under the section [Session: saved at previous logout]--maybe that is what you meant.  There are also some lines such as: discardCommand14[$e]=rm,$HOME/.config/session/okular_102b23022f7285000153793688600000013880083_1538059437_972466.  Just pointing this out because it references okular, don't know if that's normal.

> Can you also try to restore okular session state manually, by starting
> okular from command line with the identifier from ksmserverrc as argument,
> like
> 
> $ okular -session 1013f135148e5000154010731700000012941302_1540107347_651405
> 
> Do you still get "Could not open file" this way?

Doing this does not produce the error.

> 
> Could you also attach the content of the file(s)
> $HOME/.config/session/okular_<identifier_from_ksmserverrc>? It will contain
> the URLs for the files being tried to load.

There are several with one of two url's, which is odd because 6 or 7 files are opening.  Here is an example:

[1]
ActiveTab=0
Urls[$e]=file:$HOME/SpiderOak Hive/record/CG Application Instruction Guide.pdf

[Number]
NumberOfWindows=1

[WindowProperties1]
ClassName=Shell
Height 1080=1051
MenuBar=Disabled
ObjectName=okular::Shell#1
State=AAAA/wAAAAD9AAAAAAAAB4AAAAP1AAAABAAAAAQAAAAIAAAACPwAAAABAAAAAgAAAAEAAAAWAG0AYQBpAG4AVABvAG8AbABCAGEAcgEAAAAA/////wAAAAAAAAAA
Width 1920=1920


Should I simply delete all of the "restartCommand13=/usr/bin/okular,-session,102b23022f7285000153793686000000013880082_1538059437_972580", etc. lines?
Comment 3 Tobias Deiminger 2018-10-22 08:16:12 UTC
(In reply to dustin.fenster from comment #2)
> they are under the section [Session: saved at previous
> logout]--maybe that is what you meant.
No, I guessed "saved by user", because you initially wrote okular documents "were all closed after use". If okular had actually been closed when you logged out, okular can't appear in "saved at previous logout". That's at least how I understand the XSMP protocol and ksmserver. We can discuss details in the mailing list if you want.

But you also write "now open upon each restart". That's wired. Can you check the timestamp of ksmserverrc for when it was last modified, and reconsider if that timestamp matches with the last time you logged out/shutdown? On logout ksmserver should update the "saved at previous logout" section, and possibly existing okular entries should be vanished (unless okular is still open).

> There are also some lines such as:
> discardCommand14[$e]=rm,$HOME/.config/session/
> okular_102b23022f7285000153793688600000013880083_1538059437_972466.  Just
> pointing this out because it references okular, don't know if that's normal.
That's fine, ksmserver needs the entries to clean up old sessions.

> > Do you still get "Could not open file" this way?
> 
> Doing this does not produce the error.
Ok, sounds like your cloud service is also started during KDE login, and the local storage is not yet available at the early stage when ksmserver restores application sessions. Might that be?

> There are several with one of two url's, which is odd because 6 or 7 files
> are opening
Sorry, no idea about that.

> Should I simply delete all of the
> "restartCommand13=/usr/bin/okular,-session,
> 102b23022f7285000153793686000000013880082_1538059437_972580", etc. lines?
The cleanest way is probably to backup ~/.config/ksmserverrc and $HOME/.config/session/*, then remove all those files, and restart. You should start with a "clean" session again.
Comment 4 dustin.fenster 2018-10-23 02:50:49 UTC
(In reply to Tobias Deiminger from comment #3)
> (In reply to dustin.fenster from comment #2)
> > they are under the section [Session: saved at previous
> > logout]--maybe that is what you meant.
> No, I guessed "saved by user", because you initially wrote okular documents
> "were all closed after use". If okular had actually been closed when you
> logged out, okular can't appear in "saved at previous logout". That's at
> least how I understand the XSMP protocol and ksmserver. We can discuss
> details in the mailing list if you want.

Hmm. Don't know what happened, then.

> 
> But you also write "now open upon each restart". That's wired. Can you check
> the timestamp of ksmserverrc for when it was last modified, and reconsider
> if that timestamp matches with the last time you logged out/shutdown? On
> logout ksmserver should update the "saved at previous logout" section, and
> possibly existing okular entries should be vanished (unless okular is still
> open).

I don't see a timestamp.  Also, there have been several restarts and okular is definitely not open.

> 
> > There are also some lines such as:
> > discardCommand14[$e]=rm,$HOME/.config/session/
> > okular_102b23022f7285000153793688600000013880083_1538059437_972466.  Just
> > pointing this out because it references okular, don't know if that's normal.
> That's fine, ksmserver needs the entries to clean up old sessions.
> 
> > > Do you still get "Could not open file" this way?
> > 
> > Doing this does not produce the error.
> Ok, sounds like your cloud service is also started during KDE login, and the
> local storage is not yet available at the early stage when ksmserver
> restores application sessions. Might that be?

Could be.  

> 
> > There are several with one of two url's, which is odd because 6 or 7 files
> > are opening
> Sorry, no idea about that.
> 
> > Should I simply delete all of the
> > "restartCommand13=/usr/bin/okular,-session,
> > 102b23022f7285000153793686000000013880082_1538059437_972580", etc. lines?
> The cleanest way is probably to backup ~/.config/ksmserverrc and
> $HOME/.config/session/*, then remove all those files, and restart. You
> should start with a "clean" session again.

I have deleted the lines and everything is good.  I also start with a new session now at login.  
Thanks for your help.
Comment 5 Tobias Deiminger 2018-10-23 09:05:29 UTC
(In reply to dustin.fenster from comment #4)
> I don't see a timestamp.

I meant
$ stat -c %y ~/.config/ksmserverrc

> Also, there have been several restarts and okular
> is definitely not open.

Not cleaning up/updating session state would indeed be a bug (not necessarily in okular), but I couldn't reproduce it by any means. If you once should be able to reproduce, please come back and tell how.

> I have deleted the lines and everything is good.  I also start with a new
> session now at login.  
> Thanks for your help.

No problem. I'm closing this as it's working for you now.