** Description changed:

+ [impact]
+ 
+ services configured with both OnFailure= and Restart= directives will
+ both start the failure service(s), as well as restarting itself.  The
+ documentation (and later versions) indicate that OnFailure= services
+ will only be started once the service actually does stop (due to
+ failure) once its restart limit has been exceeded.
+ 
+ [test case]
+ 
+ create service files as:
+ 
+ ubuntu@lp1849261-b:/etc/systemd/system$ cat test.service 
+ [Unit]
+ OnFailure=failure.service
+ 
+ [Service]
+ ExecStart=/bin/sh -c '/bin/sleep 10; /bin/false'
+ Restart=always
+ 
+ ubuntu@lp1849261-b:/etc/systemd/system$ cat failure.service 
+ [Service]
+ ExecStart=/bin/true
+ 
+ 
+ perform daemon-reload, and then start test service:
+ 
+ ubuntu@lp1849261-b:/etc/systemd/system$ sudo systemctl daemon-reload 
+ ubuntu@lp1849261-b:/etc/systemd/system$ sudo systemctl start test
+ 
+ wait for a while for the test service to exit - at least 10 seconds, as
+ that's what we configured in the service, although I have waited longer
+ in this example.  Then check the journal for both test and failure
+ services:
+ 
+ ubuntu@lp1849261-b:/etc/systemd/system$ journalctl -b -u test
+ -- Logs begin at Fri 2019-12-13 00:52:50 UTC, end at Fri 2019-12-13 01:18:34 
UTC. --
+ Dec 13 01:17:43 lp1849261-b systemd[1]: Started test.service.
+ Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
+ Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
+ Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
+ Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
+ Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 1.
+ Dec 13 01:17:53 lp1849261-b systemd[1]: Stopped test.service.
+ Dec 13 01:17:53 lp1849261-b systemd[1]: Started test.service.
+ Dec 13 01:18:03 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
+ Dec 13 01:18:03 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
+ Dec 13 01:18:03 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
+ Dec 13 01:18:04 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
+ Dec 13 01:18:04 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 2.
+ Dec 13 01:18:04 lp1849261-b systemd[1]: Stopped test.service.
+ Dec 13 01:18:04 lp1849261-b systemd[1]: Started test.service.
+ Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
+ Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
+ Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
+ Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
+ Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 3.
+ Dec 13 01:18:14 lp1849261-b systemd[1]: Stopped test.service.
+ Dec 13 01:18:14 lp1849261-b systemd[1]: Started test.service.
+ Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
+ Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
+ Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
+ Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
+ Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 4.
+ Dec 13 01:18:24 lp1849261-b systemd[1]: Stopped test.service.
+ Dec 13 01:18:24 lp1849261-b systemd[1]: Started test.service.
+ Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
+ Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
+ Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
+ Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
+ Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 5.
+ Dec 13 01:18:34 lp1849261-b systemd[1]: Stopped test.service.
+ Dec 13 01:18:34 lp1849261-b systemd[1]: Started test.service.
+ 
+ 
+ ubuntu@lp1849261-b:/etc/systemd/system$ journalctl -b -u failure
+ -- Logs begin at Fri 2019-12-13 00:52:50 UTC, end at Fri 2019-12-13 01:19:15 
UTC. --
+ Dec 13 01:17:53 lp1849261-b systemd[1]: Started failure.service.
+ Dec 13 01:18:03 lp1849261-b systemd[1]: Started failure.service.
+ Dec 13 01:18:14 lp1849261-b systemd[1]: Started failure.service.
+ Dec 13 01:18:24 lp1849261-b systemd[1]: Started failure.service.
+ Dec 13 01:18:34 lp1849261-b systemd[1]: Started failure.service.
+ Dec 13 01:18:44 lp1849261-b systemd[1]: Started failure.service.
+ Dec 13 01:18:55 lp1849261-b systemd[1]: Started failure.service.
+ Dec 13 01:19:05 lp1849261-b systemd[1]: Started failure.service.
+ Dec 13 01:19:15 lp1849261-b systemd[1]: Started failure.service.
+ 
+ 
+ note that the 'failure' service should not have been started at all.
+ 
+ [regression potential]
+ 
+ this changes how service failures are handled, specifically when
+ OnFailure= services are started.  However, this changes the behavior to
+ be in line with the documentation, and the current behavior is unlikely
+ to be anyone's desired behavior - both starting the failure service
+ *and* restarting the failed service.  However, this will cause a
+ regression for anyone *expecting* both the OnFailure= service(s) to be
+ started, as well as the failing service to be restarted.
+ 
+ Any other regression would likely occur during the state change of a
+ unit, most likely during stop/exit of a service.
+ 
+ [scope]
+ 
+ This is needed only for Bionic and Xenial.
+ 
+ The patches to fix this:
+ 7f66b026bbdda6bd3ddf7f617bf2c3a475e4a665
+ 2ad2e41a72ec19159c0746a78e15ff880fe32a63
+ are included already in Disco and later.
+ 
+ [other info]
+ 
+ original description:
+ ---
+ 
  Within Ubunutu 18.04 systemd 237-3ubuntu10.31: amd64 arm64 armhf i386
  ppc64el s390x is available,
  
  The pull request for 240 is now requested to backport to 237 for Ubuntu
  18.04, which is integrated within the IBM product.
  
  Pull request: https://github.com/systemd/systemd/pull/9158

** Also affects: systemd (Ubuntu Xenial)
   Importance: Undecided
       Status: New

** Changed in: systemd (Ubuntu Xenial)
       Status: New => In Progress

** Changed in: systemd (Ubuntu Xenial)
     Assignee: (unassigned) => Dan Streetman (ddstreet)

** Changed in: systemd (Ubuntu Xenial)
   Importance: Undecided => Medium

** Tags added: xenial

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1849261

Title:
  Update systemd for ubuntu 18.04 with fix for interaction between
  OnFailure= and Restart=

Status in Ubuntu on IBM z Systems:
  In Progress
Status in systemd package in Ubuntu:
  Fix Released
Status in systemd source package in Xenial:
  In Progress
Status in systemd source package in Bionic:
  In Progress
Status in systemd source package in Disco:
  Fix Released
Status in systemd source package in Eoan:
  Fix Released

Bug description:
  [impact]

  services configured with both OnFailure= and Restart= directives will
  both start the failure service(s), as well as restarting itself.  The
  documentation (and later versions) indicate that OnFailure= services
  will only be started once the service actually does stop (due to
  failure) once its restart limit has been exceeded.

  [test case]

  create service files as:

  ubuntu@lp1849261-b:/etc/systemd/system$ cat test.service 
  [Unit]
  OnFailure=failure.service

  [Service]
  ExecStart=/bin/sh -c '/bin/sleep 10; /bin/false'
  Restart=always

  ubuntu@lp1849261-b:/etc/systemd/system$ cat failure.service 
  [Service]
  ExecStart=/bin/true

  
  perform daemon-reload, and then start test service:

  ubuntu@lp1849261-b:/etc/systemd/system$ sudo systemctl daemon-reload 
  ubuntu@lp1849261-b:/etc/systemd/system$ sudo systemctl start test

  wait for a while for the test service to exit - at least 10 seconds,
  as that's what we configured in the service, although I have waited
  longer in this example.  Then check the journal for both test and
  failure services:

  ubuntu@lp1849261-b:/etc/systemd/system$ journalctl -b -u test
  -- Logs begin at Fri 2019-12-13 00:52:50 UTC, end at Fri 2019-12-13 01:18:34 
UTC. --
  Dec 13 01:17:43 lp1849261-b systemd[1]: Started test.service.
  Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
  Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
  Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
  Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
  Dec 13 01:17:53 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 1.
  Dec 13 01:17:53 lp1849261-b systemd[1]: Stopped test.service.
  Dec 13 01:17:53 lp1849261-b systemd[1]: Started test.service.
  Dec 13 01:18:03 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
  Dec 13 01:18:03 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
  Dec 13 01:18:03 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
  Dec 13 01:18:04 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
  Dec 13 01:18:04 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 2.
  Dec 13 01:18:04 lp1849261-b systemd[1]: Stopped test.service.
  Dec 13 01:18:04 lp1849261-b systemd[1]: Started test.service.
  Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
  Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
  Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
  Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
  Dec 13 01:18:14 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 3.
  Dec 13 01:18:14 lp1849261-b systemd[1]: Stopped test.service.
  Dec 13 01:18:14 lp1849261-b systemd[1]: Started test.service.
  Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
  Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
  Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
  Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
  Dec 13 01:18:24 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 4.
  Dec 13 01:18:24 lp1849261-b systemd[1]: Stopped test.service.
  Dec 13 01:18:24 lp1849261-b systemd[1]: Started test.service.
  Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Main process exited, 
code=exited, status=1/FAILURE
  Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Failed with result 
'exit-code'.
  Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Triggering OnFailure= 
dependencies.
  Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Service hold-off time 
over, scheduling restart.
  Dec 13 01:18:34 lp1849261-b systemd[1]: test.service: Scheduled restart job, 
restart counter is at 5.
  Dec 13 01:18:34 lp1849261-b systemd[1]: Stopped test.service.
  Dec 13 01:18:34 lp1849261-b systemd[1]: Started test.service.

  
  ubuntu@lp1849261-b:/etc/systemd/system$ journalctl -b -u failure
  -- Logs begin at Fri 2019-12-13 00:52:50 UTC, end at Fri 2019-12-13 01:19:15 
UTC. --
  Dec 13 01:17:53 lp1849261-b systemd[1]: Started failure.service.
  Dec 13 01:18:03 lp1849261-b systemd[1]: Started failure.service.
  Dec 13 01:18:14 lp1849261-b systemd[1]: Started failure.service.
  Dec 13 01:18:24 lp1849261-b systemd[1]: Started failure.service.
  Dec 13 01:18:34 lp1849261-b systemd[1]: Started failure.service.
  Dec 13 01:18:44 lp1849261-b systemd[1]: Started failure.service.
  Dec 13 01:18:55 lp1849261-b systemd[1]: Started failure.service.
  Dec 13 01:19:05 lp1849261-b systemd[1]: Started failure.service.
  Dec 13 01:19:15 lp1849261-b systemd[1]: Started failure.service.

  
  note that the 'failure' service should not have been started at all.

  [regression potential]

  this changes how service failures are handled, specifically when
  OnFailure= services are started.  However, this changes the behavior
  to be in line with the documentation, and the current behavior is
  unlikely to be anyone's desired behavior - both starting the failure
  service *and* restarting the failed service.  However, this will cause
  a regression for anyone *expecting* both the OnFailure= service(s) to
  be started, as well as the failing service to be restarted.

  Any other regression would likely occur during the state change of a
  unit, most likely during stop/exit of a service.

  [scope]

  This is needed only for Bionic and Xenial.

  The patches to fix this:
  7f66b026bbdda6bd3ddf7f617bf2c3a475e4a665
  2ad2e41a72ec19159c0746a78e15ff880fe32a63
  are included already in Disco and later.

  [other info]

  original description:
  ---

  Within Ubunutu 18.04 systemd 237-3ubuntu10.31: amd64 arm64 armhf i386
  ppc64el s390x is available,

  The pull request for 240 is now requested to backport to 237 for
  Ubuntu 18.04, which is integrated within the IBM product.

  Pull request: https://github.com/systemd/systemd/pull/9158

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-z-systems/+bug/1849261/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to