<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><span>Package: nextcloud-desktop</span><br>
      <span>Version: 3.16.7-1~deb13u1</span><br>
      <span>Followup-For: Bug #1072382</span></p>
    <p><span>I can confirm this bug on Debian 13 (trixie), and I found
        that it can have a substantially more serious consequence than
        merely restarting the Nextcloud client unexpectedly.</span></p>
    <p><span>On logout from a GNOME Wayland session, Firefox requested
        activation of com.nextcloudgmbh.Nextcloud after the already
        running Nextcloud instance had been terminated:</span></p>
    <pre><code><span>dbus-daemon: Activating service name='com.nextcloudgmbh.Nextcloud'
    requested by ... firefox-esr</span></code></pre>
    <p><span>The newly D-Bus-activated Nextcloud process was started
        while the graphical session was already being torn down. It
        consequently failed to connect to Wayland/X11, but before
        terminating it requested org.freedesktop.portal.Desktop.</span></p>
    <p><span>This raced with gnome-session-restart-dbus.service. systemd
        then refused to stop/restart the user D-Bus because
        xdg-desktop-portal.service had a start job queued:</span></p>
    <pre><code><span>Transaction for dbus.service/stop is destructive
(xdg-desktop-portal.service has 'start' job queued,
but 'stop' is included in transaction).</span></code></pre>
    <p><span>gnome-session-ctl consequently reported:</span></p>
    <pre><code><span>Failed to restart DBus service:
GDBus.Error:org.freedesktop.systemd1.TransactionIsDestructive</span></code></pre>
    <p><span>The following graphical login then inherited the broken
        user-bus/portal state. Applications launched after login were
        delayed until portal/D-Bus activation timeouts of up to 120
        seconds had expired.</span></p>
    <p><span>I tested the workaround suggested in this bug by overriding
        the per-user D-Bus service:</span></p>
    <pre><code><span>~/.local/share/dbus-1/services/com.nextcloudgmbh.Nextcloud.service</span></code></pre>
    <p><span>with:</span></p>
    <pre><code><span>[D-BUS Service]
Name=com.nextcloudgmbh.Nextcloud
Exec=/bin/false</span></code></pre>
    <p><span>After reloading the D-Bus configuration, the same Firefox
        request still occurred during logout, but failed immediately
        with status 1. gnome-session-restart-dbus was then able to stop
        the user D-Bus normally in the same second.</span></p>
    <p><span>The subsequent login was immediate. Nextcloud was still
        started normally by GNOME autostart and could use
        xdg-desktop-portal successfully.</span></p>
    <p><span>I repeated the logout/login test and deliberately waited
        for a Nextcloud notification before launching applications. They
        still started immediately, excluding the Nextcloud notifications
        themselves as the cause of the delay.</span></p>
    <p><span>Thus disabling only the unintended D-Bus activation of
        Nextcloud provides a reproducible A/B test for the problem.</span></p>
    <p><span>Relevant versions:</span></p>
    <pre><code><span>Debian 13 (trixie)
nextcloud-desktop       3.16.7-1~deb13u1
firefox-esr             140.16.0esr-1~deb13u1
gnome-session-bin       48.0-1+deb13u1
gnome-session-common    48.0-1+deb13u1
dbus-user-session       1.16.2-2
systemd                 257.13-1~deb13u1</span></code></pre>
    <p><span>I will report the resulting gnome-session D-Bus restart
        race separately, since the same race can in principle be
        triggered by applications other than Nextcloud.</span></p>
    <p><br>
    </p>
  </body>
</html>