#1012840 xscreensaver-systemd doesn't exit at end of Xfce session

Package:
xscreensaver
Source:
xscreensaver
Description:
Screensaver daemon and frontend for X11
Submitter:
Sergio Gelato
Date:
2022-06-26 21:27:03 UTC
Severity:
important
#1012840#5
Date:
2022-06-15 09:07:46 UTC
From:
To:
In our environment (Debian 11, Xfce desktop, xscreensaver package installed) it often happens that xscreensaver-systemd is left running when a user logs out. As a result, the user session remains in a closing state and the user slice is not shut down. Sending a SIGHUP to xscreensaver-systemd is enough to get things unstuck and results in a full cleanup of the user's processes.

I find this undesirable as it is an obstacle to implementing power saving and system management measures (e.g., reboot or shut down the system when it is not in use).

#1012840#10
Date:
2022-06-15 15:22:13 UTC
From:
To:
I don't see how this is possible. When the user logs out, the X server exits. The display connection that both xscreensaver and xscreensaver-systemd have open will close with SIGPIPE.

Send logs.

#1012840#15
Date:
2022-06-26 08:59:33 UTC
From:
To:
* Jamie Zawinski [2022-06-15 17:22:13 +0200]:

This seems to be correct.

This does not match my observations. xscreensaver does appear to have a connection to the X server, but xscreensaver-systemd does not. (It seems to have connections to DBus instead.)

The .xsession-errors logs are also generally uninformative about this issue.

$ loginctl user-status USERNAME
USERNAME (UID)
           Since: Wed 2022-06-15 10:14:31 CEST; 1 weeks 4 days ago
           State: closing
        Sessions: 3
          Linger: no
            Unit: user-UID.slice
                  ├─session-3.scope
                  │ └─3156 xscreensaver-systemd
                  └─user@UID.service
                    ├─app.slice
[...]

$ lsof +E -p 3156
COMMAND    PID       USER   FD   TYPE             DEVICE SIZE/OFF     NODE NAME
dbus-daem  730 messagebus   33u  unix 0x00000000927c8293      0t0    42197 /run/dbus/system_bus_socket type=STREAM ->INO=761 3156,xscreensa,5u
systemd-l  745       root   24r  FIFO               0,23      0t0     1303 /run/systemd/inhibit/2.ref 3156,xscreensa,8w
dbus-daem 2808   USERNAME   43u  unix 0x00000000ea386a87      0t0    20939 /run/user/UID/bus type=STREAM ->INO=39482 3156,xscreensa,3u
xscreensa 3156   USERNAME  cwd    DIR               0,47     4096 90963969 /home/USERNAME (NFSSERVER:/srv/home/USERNAME)
xscreensa 3156   USERNAME  rtd    DIR              254,0     4096        2 /
xscreensa 3156   USERNAME  txt    REG              254,0    23024  1517211 /usr/bin/xscreensaver-systemd
xscreensa 3156   USERNAME  mem    REG              254,0   149576  1443900 /usr/lib/x86_64-linux-gnu/libgpg-error.so.0.29.0
xscreensa 3156   USERNAME  mem    REG              254,0   149520  1452798 /usr/lib/x86_64-linux-gnu/libpthread-2.31.so
xscreensa 3156   USERNAME  mem    REG              254,0  1176248  1443891 /usr/lib/x86_64-linux-gnu/libgcrypt.so.20.2.8
xscreensa 3156   USERNAME  mem    REG              254,0   137568  1443950 /usr/lib/x86_64-linux-gnu/liblz4.so.1.9.3
xscreensa 3156   USERNAME  mem    REG              254,0   890800  1444201 /usr/lib/x86_64-linux-gnu/libzstd.so.1.4.8
xscreensa 3156   USERNAME  mem    REG              254,0   158400  1443308 /usr/lib/x86_64-linux-gnu/liblzma.so.5.2.5
xscreensa 3156   USERNAME  mem    REG              254,0    39912  1452801 /usr/lib/x86_64-linux-gnu/librt-2.31.so
xscreensa 3156   USERNAME  mem    REG              254,0  1839792  1452776 /usr/lib/x86_64-linux-gnu/libc-2.31.so
xscreensa 3156   USERNAME  mem    REG              254,0   733976  1445499 /usr/lib/x86_64-linux-gnu/libsystemd.so.0.30.0
xscreensa 3156   USERNAME  mem    REG              254,0   177928  1452768 /usr/lib/x86_64-linux-gnu/ld-2.31.so
xscreensa 3156   USERNAME    0r   CHR                1,3      0t0        4 /dev/null
xscreensa 3156   USERNAME    1w  FIFO               0,12      0t0    23403 pipe 3156,xscreensa,2w 3156,xscreensa,4r
xscreensa 3156   USERNAME    2w  FIFO               0,12      0t0    23403 pipe 3156,xscreensa,1w 3156,xscreensa,4r
xscreensa 3156   USERNAME    3u  unix 0x00000000c20641df      0t0    39482 type=STREAM ->INO=20939 2808,dbus-daem,43u
xscreensa 3156   USERNAME    4r  FIFO               0,12      0t0    23403 pipe 3156,xscreensa,1w 3156,xscreensa,2w
xscreensa 3156   USERNAME    5u  unix 0x00000000fdbc5fd6      0t0      761 type=STREAM ->INO=42197 730,dbus-daem,33u
xscreensa 3156   USERNAME    6w   REG               0,47    20378 90964160 /home/USERNAME/.xsession-errors.old (NFSSERVER:/srv/home/USERNAME)
xscreensa 3156   USERNAME    7w   REG               0,47    20378 90964160 /home/USERNAME/.xsession-errors.old (NFSSERVER:/srv/home/USERNAME)
xscreensa 3156   USERNAME    8w  FIFO               0,23      0t0     1303 /run/systemd/inhibit/2.ref 745,systemd-l,24r

Active instance of xscreensaver for comparison, file descriptors only:

xscreensa 3140 USERNAME    0r   CHR                1,3      0t0          4 /dev/null
xscreensa 3140 USERNAME    1w  FIFO               0,12      0t0      18891 pipe 3140,xscreensa,2w 3140,xscreensa,4r
xscreensa 3140 USERNAME    2w  FIFO               0,12      0t0      18891 pipe 3140,xscreensa,1w 3140,xscreensa,4r
xscreensa 3140 USERNAME    3u  unix 0x00000000073d9834      0t0      24944 type=STREAM ->INO=24945 1142,Xorg,82u
xscreensa 3140 USERNAME    4r  FIFO               0,12      0t0      18891 pipe 3140,xscreensa,1w 3140,xscreensa,2w
xscreensa 3140 USERNAME    5r   REG               0,21        0 4026532051 /proc/interrupts
xscreensa 3140 USERNAME    6w   REG               0,47   119300  103546886 /home/USERNAME/.xsession-errors (NFSSERVER:/srv/home/USERNAME)
xscreensa 3140 USERNAME    7w   REG               0,47   119300  103546886 /home/USERNAME/.xsession-errors (NFSSERVER:/srv/home/USERNAME)

#1012840#20
Date:
2022-06-26 09:11:36 UTC
From:
To:
Huh. Well, xscreensaver-systemd calls XOpenDisplay specifically to make this happen, and when I run xscreensaver-systemd and then kill the X server, I get this:

# ./xscreensaver-systemd -v
xscreensaver-systemd: 02:07:08: registered as "org.jwz.XScreenSaver"
xscreensaver-systemd: 02:07:08: registered as "org.freedesktop.ScreenSaver"
xscreensaver-systemd: 02:07:08: "org.gnome.SessionManager" not in use
xscreensaver-systemd: 02:07:08: "org.kde.Solid.PowerManagement.PolicyAgent" not in use

[ kill server ]

xscreensaver-systemd: 02:07:26: X connection closed
Exit 1

#1012840#25
Date:
2022-06-26 12:43:24 UTC
From:
To:

#1012840#30
Date:
2022-06-26 18:22:48 UTC
From:
To:
To Debian as a whole, please, I beg of you, stop wasting my fucking time with this bullshit.

To Sergio: before you submit a bug report in anything, UPGRADE. Not to the version that some slacking upstream asshat has made easily available to you, but to the ACTUAL LATEST VERSION.

https://www.jwz.org/blog/2016/04/i-would-like-debian-to-stop-shipping-xscreensaver/

#1012840#35
Date:
2022-06-26 21:26:02 UTC
From:
To:
control: fixed -1 6.02+dfsg1-1

To Jamie:

Thank you for your answer. Note, however, that I sent my bug report to Debian, expecting it to be handled by the Debian maintainer(s) in the context of the Debian distribution (where reporting a bug that is present in the stable release is fair game: maybe the bug won't be fixed, but other users troubleshooting the same issue will at least find the report). Version lag is one reason why it's usually better to let the Debian maintainers triage reports and choose what to forward upstream. I'm not sure why you handled this report directly; wasn't it out of your own volition?

While I very much appreciate the information you provided (I think we now understand the problem and possible fixes), I think I'll ignore advice that goes counter to https://wiki.debian.org/DontBreakDebian . That includes installing directly from unstable (as opposed to backporting from testing, which for a leaf package is usually fine apart from the loss of security support). I am indeed considering uninstalling xscreensaver altogether, but my bug report was for the benefit of those who'd rather not do that.