On Tue, Jul 27, 2021 at 10:10 AM Francis Moreau <francis.moro@xxxxxxxxx> wrote: > > Hello, > > During my application update, I want to restart my service which is > activated by a socket but want to be sure that no request sent to my > service will be missed. I also want to restart the socket too so > systemd uses the latest version of the socket unit file. > > If I restart the socket when the service is still running then I get > an error message: "rotor.socket: Socket service rotor.service already > active, refusing." > > If I stop the service first and restart the socket then there's a > short time frame where requests can be lost. The old socket has to be unbound before a new one can be put in its place. Trying to keep the service alive (holding the old listener fd) would just result in systemd not being able to bind a new socket with the same address... (And even if that was possible, the old service wouldn't be able to handle requests arriving on the new socket anyway.) So whenever you restart a socket, there will *always* be a short time frame where the old socket is closed but the new one is not yet bound/listening. But as soon as the new one is listening, it'll start queuing the requests even if the service isn't yet running (since it's a socket-activated service after all) and the number of lost requests should be minimal. -- Mantas Mikulėnas _______________________________________________ systemd-devel mailing list systemd-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/systemd-devel