reopening the session management discussion...

Benedikt Meurer benedikt.meurer at
Wed Sep 3 11:57:34 CEST 2008

Brian J. Tarricone wrote:
> Benedikt Meurer wrote:
>> Brian J. Tarricone wrote:
>>>>>>> * App can never "accidentally" fall out of the session due to a
>>>>>>> crash (I guess I'm the biggest offender here). App will always be
>>>>>>> started when the DE starts unless the user disables it.
>  >>>>>
>>>>>> Inmplementing SmRestartImmediately in xfce4-session would solve the
>>>>>> problem without loosing the flexibility of session management.
>  >>>>
>>>>> Well, who wants to do that?  Benny doesn't seem to be around, and I
>>>>> feel like there must have been a reason why he didn't implement it
>>>>> in the first place.
>  >>>
>>>> I reallty see no reason other than no time or interest.
>  >>
>>> I looked through the xfce4-session source for maybe a code comment
>>> explaining the omission, but I didn't see anything.  I also thought
>>> Benny had talked about it on the ML at some point, but a search of the
>>> archives didn't yield anything (perhaps I just suck).
>> The SmRestart thing is really tricky to get right and not very useful in
>> general. There are several special cases to consider: I.e. stop
>> respawning after a number of failed retries (app dumps core on startup),
> Well that doesn't sound too hard -- checking WIFSIGNALED() and 
> WEXITSTATUS() will tell you how the app died, and you can make an 
> intelligent decision based on that.  Hell, even init has code to not 
> respawn apps if they quit X number of times in Y seconds, so there's 
> certainly precedent for this sort of thing.
>> user killing xfwm4 to replace it with metacity (xfce4-session will
>> restart xfwm4 immediately), and so on.
> Olivier mentioned there's a way around this by making one signal 
> 'special' (SIGTERM) to the app getting killed such that it can catch 
> this signal, reset its SmRestartTypeHint to SmRestartIfRunning (or 
> SmRestartNever), and then quit.  I believe xfwm4 relies on this behavior 
> in other WMs when passed the --replace option.
>> Afterall the XSMP is not very
>> well designed for todays needs (gnome-session is probably the most
>> complete implementation and it is a total mess for this very reason).
>> SmRestartImmediately makes sense for core desktop services only, and for
>> those it would be better to have some kind of autostart using a special
>> D-Bus service name (allowing replacement). I.e.
>> org.freedesktop.WindowManager for the window manager; then i.e. starting
>> metacity would simply replace xfwm4 as window manager, simple and
>> straight forward. The session manager would simply ask the well-known
>> core services (maybe extracting their defined names from some config
>> file) for its startup command on logout (IIRC this is already possible
>> using the dbus-daemon). For the automatic restart it would be sufficient
>> to watch the name registration signals from the bus daemon and Ping the
>> service name once a name is lost. It would even be possible to migrate
>> existing applications easily providing a simple wrapper binary, which
>> does the D-Bus part.
> This sounds good to me in theory, but I feel like adding 
> SmRestartImmediately support to xfce4-session, and then making xfwm4, 
> xfdesktop, xfce4-panel, etc. use it would be doable in a couple hours, 
> whereas implementing all this new stuff would take quite a bit more time.
> It also suffers some of the same problems you mention with XSMP -- with 
> an auto-restart using a dbus Ping, you still have to make sure to not 
> respawn the app too many times in a row if it's just core-dumping on 
> startup (and here it's just as bad, because you have to wait for it to 
> register itself with the session bus, and you can't even easily get its 
> PID to tell how it's exiting).  You also have to add some sort of 
> session manager API so the app can quit and say "please don't restart 
> me; I really want to quit," because we can't yet expect ALL WMs to 
> support this, so starting metacity wouldn't register 
> org.freedesktop.WindowManager, and then the watchdog process would try 
> to ping the bus name again and would restart xfwm4.  And you also have 
> to set it up so, when a *new* WM starts, it can tell the dbus-based 
> session manager its restart command so it can write a new dbus 
> auto-activation file in ~/.local/.
> So basically you're suggesting we fix the current problem by 
> implementing a new session management protocol that hasn't been designed 
> yet and probably implements a good portion of what XSMP implements. 
> That's not a small job, by any means.  Not saying I don't agree with 
> you; I'd love to see this done, but... who has time right now?
> There's also the issue Olivier brought up about how he wants xfwm4 to 
> behave correctly outside Xfce as well, so it has to keep registering 
> itself with the session (at least until/unless everyone else implements 
> our dbus-based session management protocol)...  so we might as well just 
> make session management work the best we can without turning 
> xfce4-session into a monstrosity.
> So, looking at the path of least resistance here...  if I work on a 
> patch for xfce4-session to implement SmRestartImmediately support, will 
> you accept it?

It may sound trivial to you now, but doing it right will take you
several days, esp. testing the stuff. You can of course commit it to
xfce4-session, but I don't have time to review such a patch.

> 	-brian


More information about the Xfce4-dev mailing list