[systemd-devel] Warning to Distros: NetworkManager + systemd + nscd + nmcli deadlock issue on boot.

Colin Guthrie gmane at colin.guthr.ie
Mon Apr 2 06:37:28 PDT 2012


Hi,

Figured I'd send this as I discovered a deadlock on boot (resulting in
timeouts) that could potentially affect other distros too.

It relates to this:
http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/src/backends/NetworkManagerRedHat.c

(I've highlighted the RedHat one here, but the Mandriva one was
identical (other than comments) and other distros seem to be somewhat
similar too).

The deadlock occurs when NetworkManager is started at boot, but other
scripts also count towards network.target that have not yet completed.
In Mageia/Mandriva, one such script is network-up, which waits to see
when a network connection is actually available (i.e. DHCP has allocated
an IP etc) before continuing to do stuff like mounting remote
filesystems etc.

So in this situation, as systemd is aiming for network.target, but it's
not actually reached it yet, systemctl condrestart nscd appears to hang,
presumably waiting for network.target to be reached (as nscd.service is
ordered After network.target).

This wait inside NetworkManager itself has the side effect of blocking
any queries using nmcli. Sadly we use nmcli in our network-up script
which means that we it deadlocks waiting for nscd (as network-up
deadlocks, it will cause network.target to be delayed. Thus the restart
of nscd will also be delayed: deadlock!!)

I worked around this by writing a little wrapper around the nscd restart
which is a bit more systemd friendly:

 http://svnweb.mageia.org/packages/cauldron/networkmanager/current/SOURCES/nm-poke-nscd?view=markup


Also an alternative to this would be to use systemctl --no-block
try-restart.... (suggested by Michal Schmidt on IRC)

Hope this is useful info.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the systemd-devel mailing list