iSCSI initiator cannot recover after target restart with 100s of sessions
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
We have 2 physical servers on Ubuntu 22.04 with all the latest updates, running on kernel 5.15.0-50-generic - “s23” (iSCSI target), and “s24” (iSCSI initiator).
On s23 we setup a large amount of iSCSI targets (1024) using tgtd:
#!/bin/bash
[[ -z $TARGETS ]] && TARGETS=1024
[[ -z $BASEDIR ]] && BASEDIR="/mnt"
[[ -z $BASENAME ]] && BASENAME=
[[ -z $CFGFILE ]] && CFGFILE=
apt-get update && apt-get install -y tgt
for tgt in $(seq "$TARGETS"); do
truncate -s 512M "$disk"
cat <<EOF >> "$CFGFILE"
<target ${BASENAME}
backing-store ${disk}
</target>
EOF
done
systemctl restart tgt.service
This assumes the file system on /mnt is large enough to hold 1024*512MB files, but the size of the "drives" really shouldn't matter.
Then, on s24, we discover and log into all targets (which takes a while):
iscsiadm --mode discovery --op update --type sendtargets --portal 10.1.7.23:3260 # 10.1.7.23 = s23
iscsiadm -m node --login all
After the login procedure is done, the target server on s23 is restarted:
root@s23:~# time systemctl restart tgt.service
real 0m58.765s
user 0m0.000s
sys 0m0.009s
This takes about a minute on average. What usually happens on the initiator is that the vast majority (or sometimes all) of the block devices go into a “blocked” state (as per ‘/sys/block/
In the really bad cases there is no iSCSI traffic between the servers at all. Attempts to log out the sessions or log them in anew do nothing even if iscsiadm prints “Logging out of session …” messages. The only way to recover the initiator after this is to reboot it.
Also, trying to use the “iscsiadm -m session -P3” command hangs with the following output:
root@s24:~# iscsiadm -m session -P3
iSCSI Transport Class version 2.0-870
version 2.1.5
Target: iqn.2022-
Current Portal: 10.1.7.23:3260,1
Persistent Portal: 10.1.7.23:3260,1
When running iscsiadm with strace, it seems to get stuck polling for a response:
socket(AF_UNIX, SOCK_STREAM, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path=
write(3, "\r\0\0\
poll([{fd=3, events=POLLIN}], 1, 1000) = 0 (Timeout)
And here are the iscsid logs from around the time of the restart:
Oct 18 12:41:45 s24 iscsid[29702]: Kernel reported iSCSI connection 1318:0 error (1020 - ISCSI_ERR_
Oct 18 12:41:45 s24 iscsid[29702]: Kernel reported iSCSI connection 1929:0 error (1020 - ISCSI_ERR_
Oct 18 12:42:37 s24 iscsid[29702]: connection1177:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: connection2003:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: connection2007:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: connection1364:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: connection1117:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: connection1029:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: connection1732:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: connection1601:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: connection1115:0 is operational after recovery (4 attempts)
Oct 18 12:42:37 s24 iscsid[29702]: can not read from NL socket, error -1
I believe the netlink socket error is a good indication that the issue has occurred.
This is quite consistently reproducible using the default settings in iscsid.conf. Increasing the ‘node.session.
The version of open-iscsi is 2.1.5-1ubuntu1 and tgt is 1:1.0.80-1ubuntu2.
description: | updated |
Status changed to 'Confirmed' because the bug affects multiple users.