Bug 435313 - Shutdown/reboot from kmserver-logout-greeter makes re-opened apps think they crashed
Summary: Shutdown/reboot from kmserver-logout-greeter makes re-opened apps think they ...
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: Session Management (show other bugs)
Version: 5.24.0
Platform: unspecified Linux
: NOR normal
Target Milestone: 1.0
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-03 15:19 UTC by edgars.polis
Modified: 2025-02-14 03:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Cat of ksmserverrc (639.51 KB, image/png)
2021-04-03 16:02 UTC, edgars.polis
Details
ksmserverrc file after a reboot (643 bytes, text/plain)
2021-04-03 16:05 UTC, edgars.polis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description edgars.polis 2021-04-03 15:19:35 UTC
SUMMARY


STEPS TO REPRODUCE
0. Have a VM/computer with KDE plasma
1. Set Settings > Startup and Shutdown > Desktop session > When logged in
   to "Start with an empty session"
2. Open Firefox, navigate to a page
3. Open a chromium based browser, navigate to a page
4. Open LibreOffice, create a document, modify it, save it.
5. With all windows still open, restart your computer using the Application launcher.
6. After the restart, open both browsers and LibreOffice

OBSERVED RESULT
Firefox will silently recover the previous session (even if set otherwise in the settings)
Chromium will show a "Restore pages? Browser didn't shut down correctly." prompt
LibreOffice will show a "Document recovery" prompt

EXPECTED RESULT
Firefox respects set startup settings (in this case, start with an empty session)
Chromium respects set startup settings (in this case, start where you left off, no restore prompt)
LibreOffice can be opened without a crash recovery dialogue


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.21.3
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
The expected result can be achieved by using the "sudo shutdown -r now" command, with the exception of LibreOffice, which seems to prompt recovery no matter what.
I have had this issue with both Manjaro and Neon on my laptop and a VM respectively.
I am also unsure if this is the correct category, but it seems the closest one.

To demonstrate the issue, I booted up a fresh install on Gnome Boxes(VM software), and recorded rebooting both with the launcher and command.
Observed (trips crash detection): https://youtu.be/smId0VmppC0
Expected (save for libreoffice): https://youtu.be/pnnjxgU7Kq4
Comment 1 David Edmundson 2021-04-03 15:54:47 UTC
We are respecting the setting, as nothing is happening until you manually launch the browser. ksmserver startup sounds correct.

Can you maybe upload your ~/.config/ksmserverrc and/or verify there is no section titled: 
[Session: saved at previous logout]


What we're seeing here is clients doing something completely internal to the client. What is interesting is that they're claiming they crashed. 

Can you read the end of 'journalctl --user -b -1'
(user logs from last boot) and see if it mentions these apps.

Do we see something similar with dolphin/kate?
Comment 2 edgars.polis 2021-04-03 16:02:57 UTC
Created attachment 137313 [details]
Cat of ksmserverrc

A cat output of ~/.config/ksmserverrc next to a crash recovery brave browser and setting indicating "start with an empty session"
Comment 3 edgars.polis 2021-04-03 16:05:58 UTC
Created attachment 137314 [details]
ksmserverrc file after a reboot

ksmserverrc file from my VM after a reboot with Brave browser open
Comment 4 edgars.polis 2021-04-03 16:15:52 UTC
> Can you read the end of 'journalctl --user -b -1'
> (user logs from last boot) and see if it mentions these apps.
I do not, I even tried `journalctl --user -b -1 | grep firefox` and it returned no results

> Do we see something similar with dolphin/kate?
I could not reproduce it with kate.
If I save it, then there is no issue
If I do not, then it will postpone the logout until I take action

One interesting thing that I notice, is that these windows "stick around" for a while when even the plasma shell seems to be stopped. As far as I can tell they are still fully interactive.
You can clearly see that here https://youtu.be/smId0VmppC0?t=137 (timestamp included)

It may be that they are behaving unexpectedly and not closing the way plasma wants, so they are terminated.
Rebooting with both Kate and Firefox open, Kate closes immediately, but Firefox can still be seen for a good 3 seconds surrounded by a blank screen
Comment 5 edgars.polis 2021-04-03 16:19:36 UTC
> One interesting thing that I notice, is that these windows "stick around"
> for a while when even the plasma shell seems to be stopped. As far as I can
> tell they are still fully interactive.
> You can clearly see that here https://youtu.be/smId0VmppC0?t=137 (timestamp
> included)
> 
> It may be that they are behaving unexpectedly and not closing the way plasma
> wants, so they are terminated.
> Rebooting with both Kate and Firefox open, Kate closes immediately, but
> Firefox can still be seen for a good 3 seconds surrounded by a blank screen

Sorry, I meant Brave browser. Firefox seems to close immediately
Comment 6 edgars.polis 2021-04-03 17:15:17 UTC
I ran `brave --enable-logging=stderr --v=1 > log.txt 2>&1` to open the Brave browser with logging enabled, and rebooted the system both with the prompt and with a command.
First thing that I have noticed is that rebooting with a command(no crashes) is that the log file includes a "Histogram"


And the second is that rebooting with the prompt (Brave thinks that it as crashed) the last two log entries are:
> [2211:2211:0403/125901.829967:ERROR:connection.cc(66)] X connection error received. 
> [2211:2227:0403/125901.829900:ERROR:connection.cc(66)] X connection error received.
Another time it is:
> [1989:1989:0403/131034.610368:WARNING:browser_main_loop.cc(273)] Gdk: brave: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
root

And another:
> [1825:1831:0403/131229.024627:ERROR:connection.cc(66)] X connection error received.
> [1649:1649:0403/131229.025664:WARNING:browser_main_loop.cc(273)] Gdk: brave: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
> [1825:1825:0403/131229.025584:ERROR:connection.cc(66)] X connection error received.

So it may be that the X server gets shut down before the browser has the chance to close?
That may explain why it has no problems when using `shutdown -r now`, because they probably kill processes in a different order
Comment 7 Nate Graham 2025-01-15 18:59:31 UTC
Is this still happening in a recent version of Plasma, like 6.2.5 or later?
Comment 8 Bug Janitor Service 2025-01-30 03:47:17 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 9 Bug Janitor Service 2025-02-14 03:46:45 UTC
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.