** Description changed:
- Iscsid restart fails when killed with a SIGTERM.
+ [Impact]
+ iscsid restart fails when killed with SIGTERM
- Conditions:
- Iscsid restart policy set to "Always" via a .conf file in
/etc/systemd/system/iscsid.service.d/, with the contents:
- [Service]
- Restart=always
+ [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.
- Steps to Reproduce:
- 1. Confirm iscsid is running, e.g.
- $ ps aux | grep iscsid
- or
- $ pgrep iscsid
+ 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).
- 2. Kill the pid(s) with SIGTERM, e.g.
- $ sudo kill -15 <pid>
- or
- $ sudo pkill iscsid
+ [Test Case]
+ 1) Deploy a Disco VM e.g. with uvt-kvm
+ $ uvt-kvm create disco release=disco
- 3. Confirm that iscsid has not restarted
- $ systemctl status iscsid
+ 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@disco:~$ ./deploy-tgt.sh
- This bug affects 18.04, but not 16.04. This hasn't been tested on 18.10
- or later.
+ 3) Kill iscsid with SIGTERM
+ ubuntu@disco:~$ sudo pkill iscsid
+
+ 4) Try to stop iscsid.service and check whether it hangs
+ ubuntu@disco:~$ sudo systemctl stop iscsid
+
+ If we remove the ExecStop= directive, it works as expected:
+ ubuntu@disco:~$ sudo systemctl stop iscsid
+ ubuntu@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.
** Also affects: open-iscsi (Ubuntu Disco)
Importance: High
Status: Triaged
** Also affects: open-iscsi (Ubuntu Cosmic)
Importance: Undecided
Status: New
** Changed in: open-iscsi (Ubuntu Bionic)
Status: Triaged => Confirmed
** Changed in: open-iscsi (Ubuntu Cosmic)
Status: New => Confirmed
** Changed in: open-iscsi (Ubuntu Disco)
Status: Triaged => Confirmed
** Changed in: open-iscsi (Ubuntu Cosmic)
Importance: Undecided => High
** Changed in: open-iscsi (Ubuntu Disco)
Assignee: (unassigned) => Heitor R. Alves de Siqueira (halves)
** Changed in: open-iscsi (Ubuntu Cosmic)
Assignee: (unassigned) => Heitor R. Alves de Siqueira (halves)
** Changed in: open-iscsi (Ubuntu Bionic)
Assignee: (unassigned) => Heitor R. Alves de Siqueira (halves)
** Attachment added: "deploy-tgt.sh"
https://bugs.launchpad.net/ubuntu/+source/open-iscsi/+bug/1821255/+attachment/5250279/+files/deploy-tgt.sh
** Description changed:
[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.
+ 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
+ $ 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@disco:~$ ./deploy-tgt.sh
+ ubuntu@disco:~$ ./deploy-tgt.sh
3) Kill iscsid with SIGTERM
- ubuntu@disco:~$ sudo pkill iscsid
+ ubuntu@disco:~$ sudo pkill iscsid
4) Try to stop iscsid.service and check whether it hangs
- ubuntu@disco:~$ sudo systemctl stop iscsid
+ ubuntu@disco:~$ sudo systemctl stop iscsid
If we remove the ExecStop= directive, it works as expected:
- ubuntu@disco:~$ sudo systemctl stop iscsid
- ubuntu@disco:~$
+ ubuntu@disco:~$ sudo systemctl stop iscsid
+ ubuntu@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.
+ 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.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1821255
Title:
Restart policy "Always" doesn't work under certain circumstances
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/open-iscsi/+bug/1821255/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs