Re: dhclient causes delay during shutdown



On Wed, Sep 2, 2015 at 4:48 PM, Thomas Haller <thaller redhat com> wrote:
On Wed, 2015-09-02 at 15:52 +0200, Andreas Müller wrote:
Hi

since a while shutting down my embedded device has a delay of 10s. I
see:

[  OK  ] Stopped D-Bus System Message Bus.
[  OK  ] Stopped Network Manager.
[  OK  ] Stopped Kernel Logging Service.
...
[  OK  ] Reached target Shutdown.
[ 5778.268022] systemd-shutdown[1]: Sending SIGTERM to remaining
processes...
[ 5778.293797] systemd-journald[131]: Received SIGTERM from PID 1
(systemd-shutdow).
[ 5788.305137] systemd-shutdown[1]: Sending SIGKILL to remaining
processes...
[ 5788.339046] systemd-shutdown[1]: Sending SIGKILL to PID 11829
(dhclient).
...

From this log I gather:

1) networkmanager does not stop dhclient (although it started it -
right?)
2) dhclient does not catch SIGTERM

Further investigation lead to the following commit in dhcp [1]

commit e9326fd0f4561db5496f18523da15612213bd1b4
Author: Shawn Routhier <sar isc org>
Date:   Wed Jul 2 08:49:19 2014 -0700

    [master] Add define to disable gentle shutodwn by default

    Add a define to disable the gentle shutdown feature by default.
    The feature has some effects (recover-wait in failvoer pairs)
    and release in clients that are always desired.  We plan to
    revisit this in order to make it easier to use but with the
    define it can be enabled if necessary.

My current conclusion:

networkmanager does not stop dhclient during shutdown (but it
should?). This was wiped away by systemd killing dhclient by sending
SIGTERM. Now that dhclient ignores SIGTERM, systemd waits 10s and
kills dhclient by SIGKILL which is the delay I see.

FWIW: I worked around the shutdown delay by

#define ENABLE_GENTLE_SHUTDOWN

in dhcp but I think this is a workaround so I ask here.

What do experts think?

Hi,


On shutdown, NetworkManager receives SIGTERM from systemd.
NM does in that moment not know the reason for the shutdown.
It is indistinguishable from a `systemctl restart`,
or `systemctl start`, or `systemd isolate rescue.target`...

NetworkManager always leaves your ethernet interfaces up when it
terminates. (Wifi actually gets disconnected, but I think that is
rather a bug than a feature).
It does so, because it does not want to break your network
connectivity.
I was not aware of that and simply thinking a process which spawns
others is responsible to kill them.

Isn't this a bug in dhclient?

Yes - but I thought we had a bug here too. Now I learned it is
expected behaviour.

Not a real solution, but you could use the internal DHCP client,
by setting
  [main]
  dhcp=internal
in NetworkManager.conf.


Yes I could (as said I worked around already by enabling 'gentle'
shutdown in dhclient).

Andreas


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