[Bug 1821255] Re: Restart policy "Always" doesn't work under certain circumstances
Heitor R. Alves de Siqueira
1821255 at bugs.launchpad.net
Thu Mar 28 19:23:28 UTC 2019
I've updated the description with a simpler test case that doesn't require an
override file, but this bug can also be verified with the Restart=always directive:
ubuntu at disco:~$ cat /etc/systemd/system/iscsid.service.d/override.conf
[Service]
Restart=always
ubuntu at disco:~$ sudo pkill iscsid
ubuntu at disco:~$ sudo systemctl status iscsid
● iscsid.service - iSCSI initiator daemon (iscsid)
Loaded: loaded (/lib/systemd/system/iscsid.service; disabled; vendor pre
Drop-In: /etc/systemd/system/iscsid.service.d
└─override.conf
Active: inactive (dead)
Docs: man:iscsid(8)
** Tags added: sts
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to open-iscsi in Ubuntu.
https://bugs.launchpad.net/bugs/1821255
Title:
Restart policy "Always" doesn't work under certain circumstances
Status in open-iscsi package in Ubuntu:
Confirmed
Status in open-iscsi source package in Bionic:
Confirmed
Status in open-iscsi source package in Cosmic:
Confirmed
Status in open-iscsi source package in Disco:
Confirmed
Bug description:
[Impact]
iscsid restart fails when killed with SIGTERM
[Description]
If systemd tries to execute a command that talks to iscsid via iscsid.socket, it can hang if iscsid is not running (or is in the process of being stopped). This can happen due to the current ExecStop= directive, which calls iscsiadm to kill iscsid, and prevents the service from being restarted even when we set Restart=always in the iscsid unit file.
The solution is to let systemd terminate iscsid by itself. The default action
when omitting the ExecStop directive is to send SIGTERM to the process group,
which is equivalent to invoking "iscsiadm -k" (the current ExecStop command).
[Test Case]
1) Deploy a Disco VM e.g. with uvt-kvm
$ uvt-kvm create disco release=disco
2) Run the deploy-tgt.sh script in the VM to setup an iSCSI target in the
localhost. The script will install tgt and open-iscsi, configure a 1G
file-backed iSCSI target, login and restart iscsid.service
ubuntu at disco:~$ ./deploy-tgt.sh
3) Kill iscsid with SIGTERM
ubuntu at disco:~$ sudo pkill iscsid
4) Try to stop iscsid.service and check whether it hangs
ubuntu at disco:~$ sudo systemctl stop iscsid
If we remove the ExecStop= directive, it works as expected:
ubuntu at disco:~$ sudo systemctl stop iscsid
ubuntu at disco:~$
This also causes Restart=always to work as expected.
[Regression Potential]
This shouldn't introduce any regressions, since iscsiadm -k just sends SIGTERM to iscsid's process group and that's equivalent to the default systemd ExecStop action. Nonetheless, changes will be tested with autopkgtests and different iscsi scenarios.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/open-iscsi/+bug/1821255/+subscriptions
More information about the foundations-bugs
mailing list