[systemd-devel] How soon after login can I rely on systemd --user having reached sockets.target?

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Oct 20 05:47:44 PDT 2014


On Mon, Oct 20, 2014 at 02:16:30PM +0400, Andrei Borzenkov wrote:
> On Mon, Oct 20, 2014 at 1:02 PM, David Herrmann <dh.herrmann at gmail.com> wrote:
> > Btw., manager_check_finished() doesn't explicitly wait for
> > default.target, but instead waits for all jobs to be done. Not sure
> > why..
> 
> Because default.target can be reached long before all jobs that are
> part of transaction finish. Do not forget that Wants != After.
It's confusing, but being Wanted by a target automatically adds a
Before dependency.

> > Anyway, this means any dynamically scheduled jobs will also
> > contribute to this delay.
> >
> 
> OTOH it means that if your service has "systemctl start
> other.service", other.service will contribute.
> 
> I wonder - does it wait for *any* job or only for those started as
> part of initial transaction? Arguably, the latter would be the right
> semantic here, not?
I guess that it didn't matter too much so far, given that an "empty"
user session starts in tens of milliseconds. But not it's starting to
matter and we should define something sane here.

Allowing the initial transaction to complete is not good, becuase
if one adds a job like "fetch all my mail", "preload the cache", or
anything else which is perfectly reasonable but could take unbounded
time, the user will be blocked out.

default.target is better, but still to much I think. We need the
equivalent of systemd-user-sessions.service or basic.target, that
would mean "basic user infrastracture is in place and a shell
or a graphical env can be launched, user sockets are open, even
if the services are not fully there yet".

Zbyszek




More information about the systemd-devel mailing list