Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2136544

Summary: iSCSI initiator cannot recover after target restart with large number of sessions
Product: Red Hat Enterprise Linux 8 Reporter: StorPool <redhat>
Component: iscsi-initiator-utilsAssignee: Chris Leech <cleech>
Status: CLOSED MIGRATED QA Contact: Martin Hoyer <mhoyer>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.6CC: mhoyer, mlombard
Target Milestone: rcKeywords: MigratedToJIRA
Target Release: ---Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-23 12:55:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description StorPool 2022-10-20 15:04:31 UTC
Description of problem:
When an iSCSI initiator has a large number of sessions (1024 in the example below) open with a target server, rebooting the target or setting its firewall to reject traffic for a short period of time (15-30s) leaves some or all of the iSCSI sessions in a broken state. They cannot be logged out or logged in again using 'iscsiadm' - “Logging out of session …” messages are printed, but session/block device state is not affected. The only way to clear the state is to reboot the initiator. Also, ‘iscsiadm’ hangs when trying to print more session information.

Version-Release number of selected component (if applicable):
iscsi-initiator-utils.x86_64          6.2.1.4-4.git095f59c
kernel.x86_64                         4.18.0-372.26.1

How reproducible:
Easily reproducible on every attempt.

Steps to Reproduce:

Setup the target with the following script (it requires 1024*512M space on /mnt, but disk size can be reduced)

#!/bin/bash
[[ -z $TARGETS ]] && TARGETS=1024
[[ -z $BASEDIR ]] && BASEDIR="/mnt"
[[ -z $BASENAME ]] && BASENAME="iqn.2022-10.com.example"

yum install -y targetcli
firewall-cmd --permanent --add-port=3260/tcp
firewall-cmd --reload

cmds=""
for tgt in $(seq "$TARGETS"); do
        disk="disk${tgt}"
        target="${BASENAME}:tgt${tgt}"
        cmds="${cmds}cd /backstores/fileio\n"
        cmds="${cmds}create disk${tgt} ${BASEDIR}/${disk} 512M\n"
        cmds="${cmds}cd /iscsi\n"
        cmds="${cmds}create ${target}\n"
        cmds="${cmds}cd /iscsi/${target}/tpg1/luns\n"
        cmds="${cmds}create /backstores/fileio/${disk}\n"
        cmds="${cmds}cd /iscsi/${target}/tpg1/acls\n"
        cmds="${cmds}create iqn.2022-10.com.example:s26\n"
done
echo -e "$cmds" | targetcli
systemctl restart target

Create sessions on the initiator:
iscsiadm -m discoverydb --type sendtargets --portal 10.1.7.25 --discover # replace 10.1.7.25 with target IP
iscsiadm -m node --login all

One way to put the sessions in a broken state is to simply reboot the target server.
Another is to reject iSCSI packets for a short interval, e.g. by running ‘iptables -A INPUT -p tcp --dport 3260 -j REJECT; sleep 30; iptables -D INPUT -p tcp --dport 3260 -j REJECT’.



Actual results:
The vast majority of iSCSI block devices on the initiator go from “running” into a “blocked” state (as per ‘/sys/block/sd*/device/state’), and after a while reach “transport-offline”. 

Trying to use the “iscsiadm -m session -P3” command hangs with the following output:
[root@s26 ~]# iscsiadm -m session -P3
iSCSI Transport Class version 2.0-870
version 6.2.1.4-1
Target: iqn.2022-10.com.example:tgt1 (non-flash)
        Current Portal: 10.1.7.25:3260,1
        Persistent Portal: 10.1.7.25:3260,1
                **********
                Interface:
                **********
                Iface Name: default
                Iface Transport: tcp
                Iface Initiatorname: iqn.2022-10.com.example:s26
                Iface IPaddress: 10.1.7.26
                Iface HWaddress: default
                Iface Netdev: default
                SID: 1

When running the above command 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=@"ISCSIADM_ABSTRACT_NAMESPACE"}, 30) = 0
write(3, "\r\0\0\0\0\0\0\0\1\0\0\0\0\[...]”, 16104) = 16104
poll([{fd=3, events=POLLIN}], 1, 1000)  = 0 (Timeout)

Increasing the ‘node.session.timeo.replacement_timeout’ parameter in /etc/iscsi/iscsid.conf might allow for some devices to return back to a ‘running’ state (and they can be used as normal), but still leaves the system in an overall broken state.


Expected results:
The iSCSI sessions should either recover, or at least be able to be manually reconnected by doing a logout & login.

Comment 1 Martin Hoyer 2022-10-21 16:37:54 UTC
Interestingly, after doing some testing to see how many sessions is needed for this issue to happen the system eventually became able to recover expected even with 1024 sessions reliably, even though I haven't done any changes.

Comment 2 StorPool 2022-10-27 08:36:03 UTC
Can you please clarify how long it takes for the system to recover with 1024 sessions and what you are observing with regard to device and session state? In our case it can hang for hours or longer and it will not recover them without rebooting the initiator.

Comment 3 Martin Hoyer 2022-10-27 09:01:03 UTC
(In reply to redhat from comment #2)
> Can you please clarify how long it takes for the system to recover with 1024
> sessions and what you are observing with regard to device and session state?
> In our case it can hang for hours or longer and it will not recover them
> without rebooting the initiator.

Yes, I had the same results initially. What I'm trying to say is that after multiple attempts with lower number of sessions on the same two systems I eventually got to test this with 1024 sessions again and it worked as expected.

Comment 4 StorPool 2022-10-27 11:11:04 UTC
This is an interesting, somewhat odd observation, and I could try to reproduce it locally, although I am unsure whether it will actually be helpful in understanding the problem further. Is there anything we can try or more information we can gather to assist with figuring this out?

Comment 5 Martin Hoyer 2022-10-27 14:35:34 UTC
(In reply to redhat from comment #4)
Indeed, it might or might not be a useful information for the devs, but I don't think it's worth trying to reproduce it at the moment. 

@mlombard Any chance you can take a look into this issue?

Comment 6 Maurizio Lombardi 2022-11-09 14:19:32 UTC
(In reply to Martin Hoyer from comment #5)
> (In reply to redhat from comment #4)
> Indeed, it might or might not be a useful information for the devs, but I
> don't think it's worth trying to reproduce it at the moment. 
> 
> @mlombard Any chance you can take a look into this issue?

Ok I am going to look at it

Comment 7 StorPool 2022-11-24 11:39:51 UTC
Thanks for taking on the bug investigation. Please let us know if we can test/reproduce something that will yield additional information or be helpful otherwise.

Comment 8 StorPool 2023-02-08 17:09:58 UTC
Hello,

Have you had the chance to take a look at the problem? We're still affected and available for any additional testing and information you might need.

Comment 9 RHEL Program Management 2023-09-23 12:55:12 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 10 RHEL Program Management 2023-09-23 12:55:51 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.