[Bug 1839290] Re: systemd doesn't restart a service after crashes

Vladimir Kononov voldemark at gmail.com
Wed Feb 12 09:35:58 UTC 2020


Here is a minimal example, courtesy of bl33pbl0p from the github issue.
I've double-checked it and it is valid test case for this issue:

$ systemctl cat foo
# /etc/systemd/system/foo.service
[Unit]
PartOf=bar.service
[Service]
ExecStart=/bin/sleep infinity
RestartSec=0s
Restart=always

$ systemctl cat bar
# /etc/systemd/system/bar.service
[Unit]
BindsTo=foo.service
#Same with or without After=, the window is very small to make a difference.
After=foo.service
[Service]
ExecStart=/bin/sleep infinity

$ sudo systemctl status foo bar
● foo.service
   Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset: enabled)
   Active: active (running) since Wed 2020-02-12 11:38:30 MSK; 36s ago
 Main PID: 1614 (sleep)
    Tasks: 1
   Memory: 172.0K
      CPU: 1ms
   CGroup: /system.slice/foo.service
           └─1614 /bin/sleep infinity

Feb 12 11:38:30 pono-mac systemd[1]: Started foo.service.

● bar.service
   Loaded: loaded (/etc/systemd/system/bar.service; static; vendor preset: enabled)
   Active: active (running) since Wed 2020-02-12 11:38:30 MSK; 36s ago
 Main PID: 1625 (sleep)
    Tasks: 1
   Memory: 188.0K
      CPU: 972us
   CGroup: /system.slice/bar.service
           └─1625 /bin/sleep infinity

Feb 12 11:38:30 pono-mac systemd[1]: Started bar.service.

$ sudo kill -6 1614
$ sudo systemctl status foo bar
● foo.service
   Loaded: loaded (/etc/systemd/system/foo.service; static; vendor preset: enabled)
   Active: failed (Result: resources) since Wed 2020-02-12 11:39:24 MSK; 2s ago
  Process: 1614 ExecStart=/bin/sleep infinity (code=killed, signal=ABRT)
 Main PID: 1614 (code=killed, signal=ABRT)

Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Unit entered failed state.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Failed with result 'signal'.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Service has no hold-off time, scheduling restart.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Failed to schedule restart job: Transaction is destructive.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Unit entered failed state.
Feb 12 11:39:24 pono-mac systemd[1]: foo.service: Failed with result 'resources'.

● bar.service
   Loaded: loaded (/etc/systemd/system/bar.service; static; vendor preset: enabled)
   Active: inactive (dead) since Wed 2020-02-12 11:39:24 MSK; 2s ago
  Process: 1625 ExecStart=/bin/sleep infinity (code=killed, signal=TERM)
 Main PID: 1625 (code=killed, signal=TERM)

Feb 12 11:38:30 pono-mac systemd[1]: Started bar.service.
Feb 12 11:39:24 pono-mac systemd[1]: Stopping bar.service...
Feb 12 11:39:24 pono-mac systemd[1]: Stopped bar.service.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1839290

Title:
  systemd doesn't restart a service after crashes

Status in systemd:
  Fix Released
Status in systemd package in Ubuntu:
  Fix Released
Status in systemd source package in Xenial:
  Incomplete
Status in systemd source package in Bionic:
  Incomplete
Status in systemd source package in Disco:
  Incomplete

Bug description:
  Affected versions of OS and systemd:
  $ cat /etc/issue
  Ubuntu 16.04.6 LTS \n \l
  $ systemd --version
  systemd 229
  +PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN

  Affected packages:
  systemd 229-4ubuntu21.22 and previous versions.

  Expected behaviour you didn't see:
  Scheduling restart of failed service.
  A process crashed by sigabrt and didn't restart.

  Description:
  The bug was reported to a systemd upstream repository: https://github.com/systemd/systemd/issues/11456
  The bug was fixed and accepted to the master branch: https://github.com/systemd/systemd/pull/11467/files

  Action:
  Include this patch to Ubuntu 16.04 and other version of Ubuntu which are supported.

To manage notifications about this bug go to:
https://bugs.launchpad.net/systemd/+bug/1839290/+subscriptions



More information about the foundations-bugs mailing list