Bug#955483: Alphanumeric ordering of depending sockets breaks restart

Balint Reczey balint.reczey at canonical.com
Fri Apr 3 16:51:05 BST 2020


Hi,

On Thu, 2 Apr 2020 13:10:13 +0200 Michael Biebl <biebl at debian.org> wrote:
> Am 02.04.20 um 12:45 schrieb Christian Ehrhardt:
> > On Thu, Apr 2, 2020 at 10:54 AM Michael Biebl <biebl at debian.org> wrote:
> >>
> >> I don't think this is going to work.
> >>
> >> You'll need to restart both the service and socket in the correct order,
> >
> > @Michael:
> > I have tried "systemctl restart service socket socket" before and it works.
> > But I was wondering if it might work just by accident, due to the service being
> > not yet fully up when the sockets restart. And I was unsure if this
> > could be racy.
> > Are you saying this is "the right order" and this way around systemd
> > will take care
> > that service and sockets won't collide in a bad way?
>
> No, I don't know for sure.

IMO the restart of sockets worked by accident because it was OK to
restart then when the service is not running.
When the service is running systemd can't restart the socket safely
and thus IMO systemd is right denying the operation.

Systemd could implement systemctl restart -r <set of units> where it
would find what and in which order should be restarted to have a
restart of the set of units and it would do stops then starts when the
ordering required that. For example it would do stop foo.service ;
restart foo.socket; start foo.service, etc.

I think it would be very complicated or to implement that reliably in
dh_installsystemd or in deb-systemd-invoke partly because local
configuration could also impact the order and set of units to restart.
In the meantime deb-systemd-invoke could fallback to do systemctl stop
...; systemctl start when restarts fail.

Cheers,
Balint



More information about the Pkg-systemd-maintainers mailing list