Package: openssh-server Version: 1:7.2p2-7 Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu ubuntu-patch yakkety
Hello, In https://launchpad.net/bugs/1584393 it was reported that "systemctl restart networking" sometimes gets into a deadlock: CGroup: /system.slice/networking.service ├─1383 /sbin/ifup -a --read-environment ├─1479 /sbin/dhclient -1 -v -pf /run/dhclient.enp0s3.pid -lf /var/lib/dhcp/dhclient.enp0s3.leases -I -df /var/lib/dhcp/dhclient6 ├─1480 /bin/sh -c /bin/run-parts --exit-on-error /etc/network/if-up.d ├─1481 /bin/run-parts --exit-on-error /etc/network/if-up.d ├─1504 /bin/sh /etc/network/if-up.d/openssh-server ├─1507 /bin/sh /usr/sbin/invoke-rc.d ssh reload └─1527 systemctl reload ssh.service This then waits for each other and only times out after 90s. I cannot reproduce the hang myself, so I'm not sure why sshd takes so long to respond. But it was reported that not blocking on reload to finish fixes this, i. e. ifup -a then finishes quickly, consequently the "restart networking" does as well, and sshd can then go on. This is done in the attached patch. Even though I cannot fully explain what's going on, it cannot hurt to be asynchronous in the if-up.d hook. Thanks for considering, Martin P.S. Any chance that sshd could start using IP_FREEBIND and avoid the if-up.d hack altogether? -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
From 14d29a2a7f499245a9e14b217140328c90e07558 Mon Sep 17 00:00:00 2001 From: Martin Pitt <martin.p...@ubuntu.com> Date: Tue, 26 Jul 2016 22:11:09 +0200 Subject: [PATCH] debian/openssh-server.if-up: Don't block on a finished reload of openssh.service This avoids deadlocking with restarting networking. LP: #1584393 --- debian/changelog | 3 +++ debian/openssh-server.if-up | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index dd6f7dc..a84a581 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ openssh (1:7.2p2-8) UNRELEASED; urgency=medium agent in the user session. Use it in ssh-agent.user-session.upstart. * Add systemd user unit for graphical sessions that use systemd. Override the corresponding upstart job in that case. + * debian/openssh-server.if-up: Don't block on a finished reload of + openssh.service, to avoid deadlocking with restarting networking. + (LP: #1584393) -- Martin Pitt <martin.p...@ubuntu.com> Mon, 25 Jul 2016 17:01:56 +0200 diff --git a/debian/openssh-server.if-up b/debian/openssh-server.if-up index dd05ea5..915284c 100644 --- a/debian/openssh-server.if-up +++ b/debian/openssh-server.if-up @@ -34,10 +34,9 @@ fi # the other hand, repeated restarts of ssh make systemd unhappy # (#756547/#757822), so use reload in that case. if [ -d /run/systemd/system ]; then - action=reload + systemctl reload --no-block ssh.service >/dev/null 2>&1 || true else - action=restart + invoke-rc.d ssh restart >/dev/null 2>&1 || true fi -invoke-rc.d ssh $action >/dev/null 2>&1 || true exit 0 -- 2.8.1
signature.asc
Description: PGP signature