[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#727708: upstart and upgrading from sysvinit scripts



Le dimanche 29 décembre 2013 à 01:10 -0800, Steve Langasek a écrit : 
> If I'm not mistaken (no references to hand - sorry), systemd upstream has
> claimed in the course of discussions on debian-devel that lazy activation is
> not the purpose of socket-based activation, and that using socket-based
> activation does not require you to pay the service startup penalty at the
> time of first connection.  However, this is not borne out by my experiments
> with systemd on Fedora (which I would presume to be the go-to source for
> best practices of systemd service activation).
> 
> On Fedora 20, after enabling the sshd and rsync service+socket units (both
> installed but disabled by default on Fedora per their policies on running
> services out-of-the-box) and rebooting, I find that both port 22 and port
> 873 are bound by pid 1.  Only upon connecting to the socket does systemd
> actually spawn the server (in the case of sshd, it spawns it as 'sshd
> -i', so has to start up the server anew on each connection; in the case of
> rsyncd, the .service definition is completely incompatible with socket-based
> activation and any attempt to connect results in the rsyncd.socket unit
> landing in a 'failed' state).

I’m not sure you can conclude that socket activation is broken from such
investigations. It looks to me that: 
      * Fedora deliberately used an inetd-like sshd setup, which is more
        suitable for a workstation to which you don’t ssh much, but not
        for a production server. 
      * You found a bug in Fedora’s rsyncd unit files.

If you don’t want lazy activation, you just need to add a
WantedBy=multi-user.target. This way, sockets will be bound by systemd
at the earliest possible time, and passed to the daemon as it is
started, but it will be started regardless of an incoming connection.

This is described in more detailed in the “systemd for administrators”
series:
http://0pointer.de/blog/projects/socket-activation2.html

-- 
 .''`.      Josselin Mouette
: :' :
`. `'
  `-


Reply to: