Bug 479029 - Improper behavior on shutdown leading to data loss
Summary: Improper behavior on shutdown leading to data loss
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Session Management (show other bugs)
Version: 5.27.10
Platform: Other Linux
: NOR critical
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-26 13:05 UTC by Gabriel Barros
Modified: 2024-02-20 17:20 UTC (History)
2 users (show)

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


Attachments
sudo journalctl -b -1 (41.93 KB, text/plain)
2023-12-26 13:05 UTC, Gabriel Barros
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabriel Barros 2023-12-26 13:05:42 UTC
Created attachment 164449 [details]
sudo journalctl -b -1

SUMMARY

Improper shutdown of everything under the kwin shell. I suspect this is a combination of moving to incomplete features on systemd, wayland and QTdBus.


STEPS TO REPRODUCE
1. Start KDE
2. Open terminal or other applications that can spawn other processes
2.1 start application that saves a PID file and remove them on exit, e.g. `qemu`
3. Open "regular" kde applications
3.1 pay attention to things that are only save on application exit, e.g. ktorrent magnet list
4. click shutdown


OBSERVED RESULT
System shutdowns extremely fast. PID files from terminal applications are still laying around. Data from KDE applications are lost: e.g. https://bugs.kde.org/show_bug.cgi?id=425898


EXPECTED RESULT
System sends and wait for applications to exit

SOFTWARE/OS VERSIONS
Linux: 6.6.8-arch1-1 (64-bit)
KDE Plasma Version: 5.27.10
KDE Frameworks Version: 5.113.0
Qt Version: 5.15.11

ADDITIONAL INFORMATION

logs for spawned process under kterminal being killed:
```
systemd[735]: Stopped Firefox Web Browser - Web Browser.
systemd[735]: app-org.kde.konsole-123.scope: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole-123.scope, ignoring: Operation not permitted
systemd[735]: app-org.kde.konsole-123.scope: Killing process 13618 (qemu-system-x86) with signal SIGKILL.
systemd[735]: app-org.kde.konsole-123.scope: Killing process 13622 (kvm-nx-lpage-recovery-13618) with signal SIGKILL.
systemd[735]: app-org.kde.konsole-123.scope: Failed to kill control group /user.slice/user-1000.slice/user@1000.service/app.slice/app-org.kde.konsole-123.scope, ignoring: Operation not permitted
systemd[735]: Stopped Konsole - Terminal.
systemd[735]: app-org.kde.konsole-123.scope: Consumed 7min 31.417s CPU time.
systemd[735]: Removed slice User Background Tasks Slice.
systemd[735]: background.slice: Consumed 5min 46.912s CPU time.
```

logs i believe are relevant to kde applications being killed
```
10:03:01 systemd[1048]: Stopped KDE Session Management Server.
10:03:01 systemd[1048]: Stopping KDE Window Manager...
10:03:01 systemd[1048]: Stopped Konsole - Terminal.
10:03:01 systemd[1048]: app-org.kde.konsole-ab0f9c53c82946e98f088cbe397d3678.scope: Consumed 1.930s CPU time.
10:03:01 kwin_wayland[1092]: kwin_core: Failed to open /dev/input/event8 device (Message recipient disconnected from message bus without replying)
10:03:01 dbus-daemon[909]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' requested by ':1.26' (uid=1000 pid=1092 comm="/usr/bin/kwin_wayland --wayland-fd 7 --socket wayl")
10:03:01 dbus-daemon[909]: [system] Activation via systemd failed for unit 'dbus-org.freedesktop.login1.service': Refusing activation, D-Bus is shutting down.
10:03:01 polkitd[933]: Unregistered Authentication Agent for unix-session:1 (system bus name :1.37, object path /org/kde/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 kded5[1201]: QDBusAbstractAdaptor: Cannot relay signal KDEDModule::moduleDeleted(KDEDModule*): Pointers are not supported: KDEDModule*
10:03:01 dbus-daemon[909]: [system] Activating via systemd: service name='org.bluez' unit='dbus-org.bluez.service' requested by ':1.27' (uid=1000 pid=1201 comm="/usr/bin/kded5")
10:03:01 dbus-daemon[909]: [system] Activation via systemd failed for unit 'dbus-org.bluez.service': Refusing activation, D-Bus is shutting down.
10:03:01 systemd[1048]: Stopped KDE Daemon.
10:03:01 systemd[1048]: plasma-kded.service: Consumed 2.147s CPU time.
```


My full shutdown logs attached (`sudo journalctl -b -1`), ktorrent was running and lost data, it never writes to syslog
Comment 1 Gabriel Barros 2023-12-26 13:06:53 UTC
Oops, meant to link to this bug on the ktorrent example https://bugs.kde.org/show_bug.cgi?id=415580
Comment 2 Gabriel Barros 2023-12-26 13:35:34 UTC
Also noticed that on wayland I do not get a close dialog for a unsaved `kate` buffer. I'm knew about Sessions Errata, but did I read that wrong? Does that errata also cause loss of data on shutdown and not just failure to save/restore open windows?

I think for Konsole I've found the root cause (and will probably quit using it ASAP) https://invent.kde.org/utilities/konsole/-/blob/master/src/MainWindow.cpp?ref_type=heads#L674 
```
bool MainWindow::queryClose()
{
    // Do not ask for confirmation during log out and power off
    // TODO: rework the dealing of this case to make it has its own confirmation
    // dialog.
    if (qApp->isSavingSession()) {
        return true;
    }
```

But that still doesn't explain improper shutdown of things like Ktorrent and Kate on my wayland/systemd system
Comment 3 David Edmundson 2024-02-20 17:18:45 UTC
Apps are now asked to quit