I’m having this issue as well (Debian 12 / Kernel 6.9.3 / BIOS 3.05) while connected to a Surface Pro Dock (perhaps this dock is problematic?).
The system was idle, probably showing a screensaver via the xscreensaver* packages, and when I returned about an hour later it was on a fresh login screen, with my previous session nowhere to be found.
.xsession-errors.old
5836 amdgpu: amdgpu_cs_query_fence_status failed.
5837 amdgpu: The CS has been rejected (-125), but the context isn't robust.
5838 amdgpu: The process will be terminated.
5839 X connection to :0.0 broken (explicit kill or server shutdown).^M
5840 xfce4-panel-Message: 11:54:56.155: Plugin cpufreq-17 has been automatically restarted after crash.
5841 XIO: fatal IO error 2 (No such file or directory) on X server ":0.0"^M
5842 after 17 requests (17 known processed) with 0 events remaining.^M
5843 XIO: fatal IO error 4 (Interrupted system call) on X server ":0.0"^M
5844 after 27429 requests (27429 known processed) with 0 events remaining.^M
5845 xscreensaver: 11:54:56: pid 1992976: xscreensaver-gfx exited unexpectedly with status 1: re-launching
5846 X connection to :0.0 broken (explicit kill or server shutdown).^M
5847 XGB: xgb.go:403: A read error is unrecoverable: read unix @->/tmp/.X11-unix/X0: read: connection reset by peer
5848 XGB: xgb.go:403: A read error is unrecoverable: EOF
5849 xscreensaver-systemd: 11:54:56: X connection closed
5850 xscreensaver: 11:54:56: pid 3901: xscreensaver-systemd exited unexpectedly with status 1
5851 panic: close of closed channel
There are also a flurry of bamfdaemon errors at the same time:
Jun 16 11:54:56 jon-laptop systemd[2818]: bamfdaemon.service: Main process exited, code=exited, status=1/FAILURE
Jun 16 11:54:56 jon-laptop systemd[2818]: bamfdaemon.service: Failed with result 'exit-code'.
Jun 16 11:54:56 jon-laptop systemd[2818]: bamfdaemon.service: Consumed 9.779s CPU time.
Jun 16 11:54:56 jon-laptop systemd[2818]: vte-spawn-8cbb9485-b5d1-4d14-922f-9349e35f3b8c.scope: Consumed 25.013s>
Jun 16 11:54:56 jon-laptop systemd[2818]: vte-spawn-3f4c43d5-eab8-41b6-bace-c61ab23c520d.scope: Consumed 29.242s>
Jun 16 11:54:56 jon-laptop systemd[2818]: gnome-terminal-server.service: Main process exited, code=exited, statu>
Jun 16 11:54:56 jon-laptop systemd[2818]: gnome-terminal-server.service: Failed with result 'exit-code'.
Jun 16 11:54:56 jon-laptop systemd[2818]: gnome-terminal-server.service: Consumed 22.395s CPU time.
Jun 16 11:54:56 jon-laptop dbus-daemon[2840]: [session uid=1000 pid=2840] Monitoring connection :1.307 closed.
Jun 16 11:54:56 jon-laptop at-spi-bus-launcher[3055]: X connection to :0 broken (explicit kill or server shutdow>
Jun 16 11:54:56 jon-laptop systemd[2818]: bamfdaemon.service: Scheduled restart job, restart counter is at 1.
Jun 16 11:54:56 jon-laptop systemd[2818]: Stopped bamfdaemon.service - BAMF Application Matcher Framework.
Jun 16 11:54:56 jon-laptop systemd[2818]: bamfdaemon.service: Consumed 9.779s CPU time.
Jun 16 11:54:56 jon-laptop systemd[2818]: Starting bamfdaemon.service - BAMF Application Matcher Framework...
Jun 16 11:54:56 jon-laptop systemd[2818]: xdg-desktop-portal-gnome.service: Main process exited, code=exited, st>
Jun 16 11:54:56 jon-laptop systemd[2818]: xdg-desktop-portal-gnome.service: Failed with result 'exit-code'.
Jun 16 11:54:56 jon-laptop systemd[2818]: xdg-desktop-portal-gnome.service: Consumed 3.627s CPU time.
Jun 16 11:54:56 jon-laptop systemd[2818]: xdg-desktop-portal-gtk.service: Main process exited, code=exited, stat>
Jun 16 11:54:56 jon-laptop systemd[2818]: xdg-desktop-portal-gtk.service: Failed with result 'exit-code'.
Jun 16 11:54:56 jon-laptop systemd[2818]: xdg-desktop-portal-gtk.service: Consumed 1.147s CPU time.
Jun 16 11:54:56 jon-laptop systemd[2818]: xfce4-notifyd.service: Main process exited, code=exited, status=1/FAIL>
Jun 16 11:54:56 jon-laptop systemd[2818]: xfce4-notifyd.service: Failed with result 'exit-code'.
Jun 16 11:54:56 jon-laptop systemd[2818]: xfce4-notifyd.service: Consumed 1.878s CPU time.
Jun 16 11:54:57 jon-laptop bamfdaemon[2046245]: cannot open display: :0
Jun 16 11:54:57 jon-laptop systemd[2818]: bamfdaemon.service: Main process exited, code=exited, status=1/FAILURE
Jun 16 11:54:57 jon-laptop systemd[2818]: bamfdaemon.service: Failed with result 'exit-code'.
Jun 16 11:54:57 jon-laptop systemd[2818]: Failed to start bamfdaemon.service - BAMF Application Matcher Framewor>
Jun 16 11:54:57 jon-laptop systemd[2818]: bamfdaemon.service: Scheduled restart job, restart counter is at 2.
Jun 16 11:54:57 jon-laptop systemd[2818]: Stopped bamfdaemon.service - BAMF Application Matcher Framework.
Jun 16 11:54:57 jon-laptop systemd[2818]: Starting bamfdaemon.service - BAMF Application Matcher Framework...
Jun 16 11:54:58 jon-laptop bamfdaemon[2046278]: Invalid MIT-MAGIC-COOKIE-1 key
Jun 16 11:54:58 jon-laptop bamfdaemon[2046278]: cannot open display: :0
I’m guess the bamf errors are a result of the session crash.
Any ideas?