GNOME Bugzilla – Bug 576633
Session saving & autostarted applications
Last modified: 2021-06-14 18:20:51 UTC
From bug 552387 comment 93: =============== the gnome-session save does not get filtered properly. I have an applet which has Exec=/usr/lib/ospm/ospm-applet which after a couple login/logout, 3 copies of it is running including the copy from /usr/share/gnome/autostart directory, ptree | grep ospm-appl 6629 /usr/lib/ospm/ospm-applet --sm-config-prefix /ospm-applet-X 6656 /usr/lib/ospm/ospm-applet --sm-config-prefix /ospm-applet-S 6659 /usr/lib/ospm/ospm-applet in $HOME/.gnome2/gnome-session/saved-session grep ospm * 10dfa650007ebba0f5123662105892043300000060280001.desktop:Name=ospm-applet 10dfa650007ebba0f5123662105892043300000060280001.desktop:Exec=/usr/lib/ospm/ospm-applet --sm-config-prefix /ospm-applet-SzaW3l/ --sm-client-id 10dfa650007ebba0f5123662105892043300000060280001 --screen 0 10ff35230049e0bdd5123662098169630600000057720001.desktop:Name=ospm-applet 10ff35230049e0bdd5123662098169630600000057720001.desktop:Exec=/usr/lib/ospm/ospm-applet --sm-config-prefix /ospm-applet-Xza40l/ --sm-client-id 10ff35230049e0bdd5123662098169630600000057720001 --screen 0 It shows the two desktop files and hence 3 copies of the applet is running. Is that a bug or is there some desktop file attributes that needs to be set? ===============
That's actually a tough thing to handle correctly for the session manager. I would think the conclusion here is that if an app is expected to be autostarted, it should either: + not be saved in the session + set a X-GNOME-Provides key in its desktop file to something unique (this way, the saved client will mask the one from the autostart dir on next login) If we don't do this, then we'll end up with two instances of the application on next login, and possibly three instances on the next one, etc. So I propose that we don't save autostarted applications unless they have a X-GNOME-Provides key in their desktop file. Looking at the list of autostarted apps here, I don't feel like any of them should be saved anyway. Opinions?
How would this play along with XSMP apps that request to be in the session on login?
(In reply to comment #2) > How would this play along with XSMP apps that request to be in the session on > login? Not sure what you mean: it seems to me that you're talking about XSMP apps that would be saved during session saving. That's what the bug is about: if the XSMP app is in the saved session and in an autostart dir, we don't want to launch it twice.
gnome-session 2.22 just compared autostart Exec lines and XSMP RestartCommands to figure out which ones were dups, and that seemed to work well enough. Bug 341286 has relevant discussion/patches (coming from the opposite direction, because the original version of the code removed too many duplicates, rather than too few like 2.26 does). For a more rigorously correct solution, gnome-session could figure out at session-save time which XSMP clients correspond to autostarted apps, and adjust the information in the session file accordingly. For autostarted apps that support X-GNOME-Autostart-Notify, gnome-session should already know that information. http://live.gnome.org/SessionManagement/NewGnomeSession has some ideas on making this work with non-X-GNOME-Autostart-Notify apps too.
I couldn't tell whether the duplication is caused by the comparison of the program name against the full path in the desktop file. Note that example has prefix in /usr/lib/ospm, where as when I printed some of the property name which is simple a program name without full path. So comparison may be invalid.
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version of gnome-session, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/gnome-session/-/issues/ Thank you for your understanding and your help.