Your message dated Fri, 15 May 2015 15:54:11 +0000
with message-id <[email protected]>
and subject line Bug#777113: fixed in sysvinit 2.88dsf-59.1
has caused the Debian Bug report #777113,
regarding invoke-rc.d, service under systemd: Avoid job dependency loops during 
boot/shutdown
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
777113: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777113
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: sysvinit-utils
Version: 2.88dsf-58
Severity: important
Tags: patch

Hello all,

Due to the way systemd job transactions work, we had and still have
several occasions where DHCP/ifupdown and similar hooks try to reload
or restart a service and cause a deadlock. That's because especially
during boot and shutdown there is a big transaction of services and
their dependencies which want to start or stop, and if within that
transaction you synchronously request another one you get a circular
dependency loop which causes such a deadlock. Examples are
https://bugs.debian.org/652942 (still open and reproducible), and
https://bugs.debian.org/635777 and https://bugs.debian.org/624599. For
the latter two the systemd package currently has workarounds, but they
don't always apply.

This is an emergent problem as we try to combine two completely
different paradigms:

 * Under SysV init, commands like "service foo restart" are always
   synchronous, i. e. they wait for the operation to finish. But they
   don't take any dependencies into account, i. e. restarting "foo"
   won't ensure that foo's dependencies are already started.

 * Under systemd, starting a unit always ensures that its dependencies
   (and ordering constraints) are fulfilled. But in that world, things
   like DHCP hooks should reload services asynchronously. (E. g. with
   systemctl --no-block reload foo)

Both are valid, the trouble comes with trying to combine them. Our
"service" and "invoke-rc.d" hooks work under all init systems and
don't offer async operations. This was discussed several times on the
systemd ML, like on

http://lists.freedesktop.org/archives/systemd-devel/2014-July/021457.html
(continuation: 
http://lists.freedesktop.org/archives/systemd-devel/2014-August/022048.html)
http://lists.freedesktop.org/archives/systemd-devel/2015-February/027966.html

But in the end all of those are just hacks which break systemd's
semantics. There is fundamentally no good way how we can fulfill both
the SysV and the systemd semantics, so we need some
heuristics/workarounds.

One such thing would be that service/invoke-rc.d always call systemctl
with --job-mode=ignore-dependencies which would make it do what SysV
does: only operate on the given job but not its dependencies. But
often this behaviour is actually handy, and the lockups realistically
only occur on boot and shutdown, so we can restrict it to these times.

That's what the attached patch does. After long discussions with
both systemd upstream as well as Michael Biebl I am now convinced that
this is the most sensible approach, doesn't break either SysV or
systemctl semantics, and is a good enough heuristics to avoid
deadlocks. Such deadlocks in principle happen during runtime as well,
but there's no evidence of that so far; if it does happen, we need to
adjust the scope of the "ignore-dependencies", but I don't think it
will be necessary.

With this I verified that all of the bugs above (plus
https://launchpad.net/bugs/1417010, which is the Ubuntu equivalent of
https://bugs.debian.org/652942) are fixed with a pristine upstream
systemd, i. e. we can drop our insufficient patches.

Thanks for considering,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
diff -Nru sysvinit-2.88dsf/debian/changelog sysvinit-2.88dsf/debian/changelog
--- sysvinit-2.88dsf/debian/changelog   2014-11-11 20:34:28.000000000 +0100
+++ sysvinit-2.88dsf/debian/changelog   2015-02-05 09:51:50.000000000 +0100
@@ -1,3 +1,16 @@
+sysvinit (2.88dsf-59) UNRELEASED; urgency=medium
+
+  * service, invoke-rc.d: Avoid deadlocks during bootup and shutdown from
+    units/hooks which call "invoke-rc.d service reload" and similar, since the
+    synchronous wait plus systemd's normal behaviour of transactionally
+    processing all dependencies first easily causes dependency loops. Thus
+    during boot/shutdown operate only on the unit and not on its dependencies,
+    just like SysV behaves.
+  * Make sysvinit-utils and sysv-rc break systemd << 215 to ensure we have the
+    "systemctl is-system-running" command.
+
+ -- Martin Pitt <[email protected]>  Thu, 05 Feb 2015 09:48:40 +0100
+
 sysvinit (2.88dsf-58) unstable; urgency=low
 
   * Fix typo in invoke-rc.d breaking upstart installations (Closes:
diff -Nru sysvinit-2.88dsf/debian/control sysvinit-2.88dsf/debian/control
--- sysvinit-2.88dsf/debian/control     2014-10-25 23:24:19.000000000 +0200
+++ sysvinit-2.88dsf/debian/control     2015-02-05 09:51:15.000000000 +0100
@@ -65,7 +65,7 @@
 Replaces: last, sysvinit (<= 2.86.ds1-65)
 Depends: ${shlibs:Depends}, ${misc:Depends}
  , startpar
-Breaks: upstart (<< 1.5-0ubuntu5)
+Breaks: upstart (<< 1.5-0ubuntu5), systemd (<< 215)
 Suggests: bootlogd, sash
 Description: System-V-like utilities
  This package contains the important System-V-like utilities.
@@ -85,7 +85,7 @@
  sysvinit-utils (>= 2.86.ds1-62),
  insserv (>> 1.12.0-10)
  , startpar
-Breaks: initscripts (<< 2.86.ds1-63)
+Breaks: initscripts (<< 2.86.ds1-63), systemd (<< 215)
 Description: System-V-like runlevel change mechanism
  This package provides support for the System-V like system
  for booting, changing runlevels, and shutting down,
diff -Nru sysvinit-2.88dsf/debian/service/service 
sysvinit-2.88dsf/debian/service/service
--- sysvinit-2.88dsf/debian/service/service     2014-10-25 23:20:33.000000000 
+0200
+++ sysvinit-2.88dsf/debian/service/service     2015-02-05 09:31:14.000000000 
+0100
@@ -184,6 +184,15 @@
 if [ -n "$is_systemd" ]
 then
    UNIT="${SERVICE%.sh}.service"
+   # avoid deadlocks during bootup and shutdown from units/hooks
+   # which call "invoke-rc.d service reload" and similar, since
+   # the synchronous wait plus systemd's normal behaviour of
+   # transactionally processing all dependencies first easily
+   # causes dependency loops
+   if ! systemctl is-system-running; then
+       sctl_args="--job-mode=ignore-dependencies"
+   fi
+
    case "${ACTION}" in
       restart|status)
          exec systemctl ${ACTION} ${UNIT}
@@ -195,10 +204,10 @@
          # Users who need more control will use systemctl directly.
          for unit in $(systemctl list-unit-files --full --type=socket 
2>/dev/null | sed -ne 's/\.socket\s*[a-z]*\s*$/.socket/p'); do
              if [ "$(systemctl -p Triggers show $unit)" = "Triggers=${UNIT}" 
]; then
-                systemctl ${ACTION} $unit
+                systemctl $sctl_args ${ACTION} $unit
              fi
          done
-         exec systemctl ${ACTION} ${UNIT}
+         exec systemctl $sctl_args ${ACTION} ${UNIT}
       ;;
       reload)
          _canreload="$(systemctl -p CanReload show ${UNIT} 2>/dev/null)"
@@ -208,7 +217,7 @@
             # specific service.
             run_via_sysvinit
          else
-            exec systemctl reload "${UNIT}"
+            exec systemctl $sctl_args reload "${UNIT}"
          fi
          ;;
       force-stop)
@@ -217,9 +226,9 @@
       force-reload)
          _canreload="$(systemctl -p CanReload show ${UNIT} 2>/dev/null)"
          if [ "$_canreload" = "CanReload=no" ]; then
-            exec systemctl restart "${UNIT}"
+            exec systemctl $sctl_args restart "${UNIT}"
          else
-            exec systemctl reload "${UNIT}"
+            exec systemctl $sctl_args reload "${UNIT}"
          fi
          ;;
       *)
diff -Nru sysvinit-2.88dsf/debian/src/sysv-rc/sbin/invoke-rc.d 
sysvinit-2.88dsf/debian/src/sysv-rc/sbin/invoke-rc.d
--- sysvinit-2.88dsf/debian/src/sysv-rc/sbin/invoke-rc.d        2014-11-08 
21:38:18.000000000 +0100
+++ sysvinit-2.88dsf/debian/src/sysv-rc/sbin/invoke-rc.d        2015-02-05 
09:32:35.000000000 +0100
@@ -519,16 +519,24 @@
                     # pick up any changes.
                     systemctl daemon-reload
                 fi
+                # avoid deadlocks during bootup and shutdown from units/hooks
+                # which call "invoke-rc.d service reload" and similar, since
+                # the synchronous wait plus systemd's normal behaviour of
+                # transactionally processing all dependencies first easily
+                # causes dependency loops
+                if ! systemctl is-system-running; then
+                    sctl_args="--job-mode=ignore-dependencies"
+                fi
                 case $saction in
                     start|stop|restart|status)
-                        systemctl "${saction}" "${UNIT}" && exit 0
+                        systemctl $sctl_args "${saction}" "${UNIT}" && exit 0
                         ;;
                     reload)
                         _canreload="$(systemctl -p CanReload show ${UNIT} 
2>/dev/null)"
                         if [ "$_canreload" = "CanReload=no" ]; then
                             "${INITDPREFIX}${INITSCRIPTID}" "${saction}" "$@" 
&& exit 0
                         else
-                            systemctl reload "${UNIT}" && exit 0
+                            systemctl $sctl_args reload "${UNIT}" && exit 0
                         fi
                         ;;
                     force-stop)
@@ -537,9 +545,9 @@
                     force-reload)
                         _canreload="$(systemctl -p CanReload show ${UNIT} 
2>/dev/null)"
                         if [ "$_canreload" = "CanReload=no" ]; then
-                           systemctl restart "${UNIT}" && exit 0
+                           systemctl $sctl_args restart "${UNIT}" && exit 0
                         else
-                           systemctl reload "${UNIT}" && exit 0
+                           systemctl $sctl_args reload "${UNIT}" && exit 0
                         fi
                         ;;
                     *)

Attachment: signature.asc
Description: Digital signature


--- End Message ---
--- Begin Message ---
Source: sysvinit
Source-Version: 2.88dsf-59.1

We believe that the bug you reported is fixed in the latest version of
sysvinit, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Andreas Henriksson <[email protected]> (supplier of updated sysvinit package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Tue, 12 May 2015 11:21:13 +0200
Source: sysvinit
Binary: sysvinit sysvinit-core sysvinit-utils sysv-rc initscripts bootlogd
Architecture: source amd64 all
Version: 2.88dsf-59.1
Distribution: unstable
Urgency: medium
Maintainer: Debian sysvinit maintainers 
<[email protected]>
Changed-By: Andreas Henriksson <[email protected]>
Description:
 bootlogd   - daemon to log boot messages
 initscripts - scripts for initializing and shutting down the system
 sysv-rc    - System-V-like runlevel change mechanism
 sysvinit   - System-V-like init utilities - transitional package
 sysvinit-core - System-V-like init utilities
 sysvinit-utils - System-V-like utilities
Closes: 399608 777113 784567
Changes:
 sysvinit (2.88dsf-59.1) unstable; urgency=medium
 .
   * Non-maintainer upload.
 .
   [ Martin Pitt ]
   * service, invoke-rc.d: Avoid deadlocks during bootup and shutdown from
     units/hooks which call "invoke-rc.d service reload" and similar, since the
     synchronous wait plus systemd's normal behaviour of transactionally
     processing all dependencies first easily causes dependency loops. Thus
     during boot/shutdown operate only on the unit and not on its dependencies,
     just like SysV behaves. (Closes: #777113)
   * Make sysvinit-utils and sysv-rc break systemd << 215 to ensure we have the
     "systemctl is-system-running" command.
 .
   [ Andreas Henriksson ]
   * Let mount (src:util-linux) provide mountpoint (Closes: #399608)
   * Let util-linux provide sulogin, last, lastb, mesg (Closes: #784567)
Checksums-Sha1:
 23159e01a961d16b5c353ead5f37f4a4f10bee9d 2475 sysvinit_2.88dsf-59.1.dsc
 157fbee53927b5a98750916c19216923dda628ab 152792 
sysvinit_2.88dsf-59.1.debian.tar.xz
 7711b3fe9ef43d21bd7bad1f0daff90d382e5601 100266 sysvinit_2.88dsf-59.1_amd64.deb
 7f82d707173f8323ae9cecfb77ffa2dd0963b5b7 132262 
sysvinit-core_2.88dsf-59.1_amd64.deb
 1321bd0db8e3b5142348450bde7af746b8159445 69638 
sysvinit-utils_2.88dsf-59.1_amd64.deb
 d83adb29564a8fda7a4465bae8aa72e2c61776f3 83290 sysv-rc_2.88dsf-59.1_all.deb
 f8a847f7d52aacf1dacb4359b550da85f6a896a1 83998 
initscripts_2.88dsf-59.1_amd64.deb
 3df9ace62869183a22f0c59c56ba720d0b8d6d34 59210 bootlogd_2.88dsf-59.1_amd64.deb
Checksums-Sha256:
 219328067437ac603c31d96177f0047433f9ad3125fe617ff92ef1933a98ac8b 2475 
sysvinit_2.88dsf-59.1.dsc
 27e22858663cd9992d9ce42478af7117492664c3668210d5fe737ab0b7cb92ab 152792 
sysvinit_2.88dsf-59.1.debian.tar.xz
 b38515f785ab9532888bbe0389d233b454b69e6aab9f253611544ae7bc6b2bc7 100266 
sysvinit_2.88dsf-59.1_amd64.deb
 1b775c0b469ff125a9ba5bf8de04037fe0903bef6fcfb1fb8fb0c2cf94259aab 132262 
sysvinit-core_2.88dsf-59.1_amd64.deb
 d029e37f81176bc5f8acc13d1c49b766d5227365d58b51a51a15456909ad762b 69638 
sysvinit-utils_2.88dsf-59.1_amd64.deb
 e27be2c6bbae17ade9cf26379d57a0f44c4f1d8edc2e669d458f959882060410 83290 
sysv-rc_2.88dsf-59.1_all.deb
 fa1d1c60a214366a5917a13ac78d101d5b0cbe5d544c8dbeadca0dbe7e77b76f 83998 
initscripts_2.88dsf-59.1_amd64.deb
 9c6ac51b463dccc5a832e52fb33e567192f93589d064e3f8ba25f15dac1e06f5 59210 
bootlogd_2.88dsf-59.1_amd64.deb
Files:
 7bf0cc98934f96160ee6a4ce4e104ecb 2475 admin required sysvinit_2.88dsf-59.1.dsc
 7ce3b389183df44d9d03513ff7e31622 152792 admin required 
sysvinit_2.88dsf-59.1.debian.tar.xz
 562c89b4edb7bf0d853508997ed25830 100266 admin optional 
sysvinit_2.88dsf-59.1_amd64.deb
 d5ff394ccda12b43c2802d77e5d253e1 132262 admin extra 
sysvinit-core_2.88dsf-59.1_amd64.deb
 2d3c150fc933522303548309a577ab93 69638 admin required 
sysvinit-utils_2.88dsf-59.1_amd64.deb
 ddeac37c501247d0032a00526fcf900a 83290 admin required 
sysv-rc_2.88dsf-59.1_all.deb
 d61be44feadb85cf2e668428dadb0414 83998 admin required 
initscripts_2.88dsf-59.1_amd64.deb
 f3861dc61256fb73c439b12871e48f93 59210 admin optional 
bootlogd_2.88dsf-59.1_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJVVgcVAAoJEAvEfcZNE1MG0t4P+wSS46w7lKy3B5L95Imd+hnD
3RR/IUgrQY/bt4+8e5XHTZRqCeteRj+s+yc6eoLrDB0HwelabsdP+k/szNjWcgEY
dIOF+O1sjyncz0uUnJmiRMrRMClG3kNnqeriZz/wQz3cGVsnW4L4ezbfdQwhhq+S
zwl8RYMMC9iQUUqaiVM1ZQHb5zxtIeNLT+KuOVnaQBILpuG8ZOo5i5KZkNxiQZmv
aHhrE5Ia8otuwk5Vb5nYdGFvdJsuLzDokLg+13kRs60y3mOHbAGmkGA0MFdx1FHN
RcAbwHKk+ZAFIBzePCOgDAJnr0Qk70pj2evjy22l+8ydwU00ngtPmZvkUJUGdc7e
ITuIMyzhRSMJ9lzBy56pZwOJbTsERlg4JVHSWhC8vk2wjSBVIMY/a0QbS+/sxWQT
xtKbAgf+jGDVBJLGCEo9iYcNMwpLNRM9pouBr9fK+08XNxEIH3HoP+TdIU0bLLtC
gghCw0hQN2fr8gn4mLoutKxYD6OPl8QIuYM+wZP2dZaIzRl/1oJyJunmeGKCOd5z
KLVS6SSHZPp6xAa5cHFUAKZUC99v3N3KWCTuGoprYlOxC9rO8Lh1rUiJqTAdYPxK
Oxgh1bV9B0tTb4NRR2i9I9YxXAtjpc7yQUBArsAvqM+JOLcrpUKJpCNjhFph8Fnf
y3BJ8rIboCnOTFbldcXN
=rWSo
-----END PGP SIGNATURE-----

--- End Message ---
_______________________________________________
Pkg-sysvinit-devel mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-sysvinit-devel

Reply via email to