[systemd-devel] systemd behavior during shutdown

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Sep 19 06:40:48 UTC 2018


On Wed, Sep 19, 2018 at 05:01:33AM +0000, Tiwari, Hari Sahaya wrote:
> Hi,
> 
> I am facing one issue with systemd where systems socket is not opening a new connection during shutdown.
> I get below logs,
> 
> Sep 12 20:01:32 jara2 systemd[1]: mytestX.socket: Incoming traffic
> Sep 12 20:01:32 jara2 systemd[1]: mytestX.socket: Suppressing connection request since unit stop is scheduled.
> 
> I have one systemd service which is trying to open a new connection during shutdown sequence but looks like systemd sockets stop accepting new connections as soon as they are marked for stop.
> I tried putting various combination of dependencies but that didn't help. Everytime getting the above message.
> 
> Is there any parameter which can be set in unit files to resolve this issue? Any pointers will be appreciated.

Hi,

yes, this is intentional. It was added to avoid the situation where
services are stop and subsequently restarted during shutdown because
something opens a connection, leading to loops.

If you absolutely need to open a connection to a socket activated
unit, then you could try making the .socket and .service units have
DefaultDependencies=false, so that they will not conflict with
shutdown.target and the start jobs will not be created for them. But
then you need to make sure that they actually *are* stopped at the
right time, but issuing a 'systemctl stop' request for them.
This can be done, but will be messy, so I'd use a different approach
if possible.

Zbyszek


More information about the systemd-devel mailing list