Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

iScsiPrt event 20 on Windows: 'Connection to the target was lost. The initiator will attempt to retry the connection'

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

Event 20 in the Windows System log reads "Connection to the target was lost. The initiator will attempt to retry the connection." Microsoft lists event 20 among the iSCSI events seen when disks disconnect or are "surprise removed", and names network instability, MPIO configuration errors, mismatched VLAN, MTU or jumbo settings, outdated firmware or drivers and array resource exhaustion as causes. Neither NetApp page prints the provider name for event 20, so iScsiPrt comes from the sources of the events listed beside it. Read how often it happens and what the sessions and adapters look like before changing anything.

What the error means

The text comes from NetApp's knowledge base, which prints the Windows events seen when iSCSI sessions to a NetApp Element volume disconnect intermittently:

  • Event ID 20: "Connection to the target was lost. The initiator will attempt to retry the connection."
  • Event ID 7: "The initiator could not send an iSCSI PDU. Error status is given in the dump data." (Microsoft's quick-reference table prints a different text for event 7, "The device has a bad block", which belongs to the disk provider.)
  • Event ID 1: "Initiator failed to connect to the target. Target IP address and TCP Port number are given in dump data."

A second NetApp page, for Data ONTAP 7 and 8 with the Microsoft iSCSI software initiator, prints the events that appear when host-side SCSI timeouts occur. Its event listing shows the source iScsiPrt against events 34, 39 and 9:

  • Event 34: "A connection to the target was lost, but the Initiator successfully reconnected to the target. Dump data contains the target name."
  • Event 39: "The Initiator sent a task management command to reset the target. The target name is given in the dump data."
  • Event 9: "Target did not respond in time for a SCSI request. The CDB is given in the dump data."

That page's own text says occasional timeouts "are not necessarily a major issue, because these requests will be re-submitted several times before the application receives IO errors", but that repeated ones might cause application errors. It is written for older Windows and ONTAP releases; read it for wording, not current settings.

Microsoft's guidance lists "Event IDs 9, 20, 27, 39, 153" under "iSCSI events and errors" for the symptom group "iSCSI disks disconnect, failover doesn't work correctly, or disks are "surprise removed"", together with "Event ID 157: "Disk X has been surprise removed"". Its quick-reference table labels events 20 and 27 "iSCSI failed to connect", although the text of event 20 says a connection was lost.

Likely causes

The first column is Microsoft's list of causes for that symptom group; the other two columns are our own advice.

Cause What you see How to confirm
Network instability Event 20 across several targets at the same time Adapter statistics and switch port counters
MPIO configuration errors Failover does not work; paths missing Get-MSDSMAutomaticClaimSettings, sessions
Network adapters or NIC teams not ready when iSCSI services start Events after a restart Event times against boot time
Mismatched VLAN, MTU or jumbo frame settings, or improper failover scripts Intermittent drops under load Compare settings on host, switch and array; read any failover scripts
Outdated firmware or drivers Intermittent drops, no config change Driver and firmware versions
Resource exhaustion on the SAN or NAS Events from one array only Array logs, from the array vendor

Prove the cause before changing anything

All of these read only. Run them in an elevated PowerShell session.

1. List the events and their times. The Get-WinEvent page shows LogName, ProviderName and ID as keys for -FilterHashtable.

Get-WinEvent -FilterHashtable @{LogName='System'; ProviderName='iScsiPrt'; ID=1,7,9,20,34,39}

The ProviderName='iScsiPrt' filter rests on NetApp's second page, which shows that source for events 34, 39 and 9; if it returns nothing, drop the provider name and filter on the IDs alone. Look at the pattern. Event 20 followed by event 34 a few seconds later means the initiator reconnected. A single event once a day is a different case from many in a minute (our own reading). Check whether the times match a backup, a restart or a switch change.

2. List the other storage events Microsoft names. For its support data collection it filters the System, Application and Storage logs for "Event IDs 9, 20, 27, 39, 43, 55, 98, 129, 153, 157, 507".

3. Read the sessions and connections. Microsoft names these cmdlets:

Get-IscsiConnection
Get-IscsiSession
Get-MSDSMAutomaticClaimSettings

The Get-IscsiSession page shows fields such as IsConnected, IsPersistent and NumberOfConnections. A session that is not connected, or fewer connections than you configured, shows where the path is broken.

4. Read the adapters. Microsoft names these:

Get-NetAdapter
Get-NetAdapterStatistics

The Get-NetAdapterStatistics page says the statistics "include broadcast, multicast, discards, and errors". Microsoft also names Get-VMSwitch and Get-VMSwitchTeam (cmdlets of the Hyper-V module).

5. Check disk and path state. Microsoft names Get-Disk and Get-PhysicalDisk, and warns: "Make sure that applications and scripts don't rely on disk numbers. Path failovers can change the numbers."

6. Check consistency end to end. Microsoft's checklist asks: "Are maximum transmission units (MTUs), virtual LANs (VLANs), Jumbo Frames, and Flow Control/ROCE/PFC consistently configured?" and, for the array, "To verify the health of the SAN or NAS, contact the vendor for more information about logs and event triggers."

Fix

Microsoft's page lists resolution steps for this symptom group. Five of them change a server that holds data or the path to it, so the save-first step and the warning come before the list.

First save the current state: in iSCSI Initiator, on the Favorite Targets tab, write down each target name, portal address and port, and write down the installed network adapter, storage and firmware driver versions. Write down the MTU on every hop. As our own read-only check, run netsh interface ipv4 show subinterfaces on the host (Microsoft's page shows only the set subinterface form of that command); it records the IP MTU only. Read the switch and array ports in their own tools. Record the adapter's jumbo packet setting separately: as our own advice, run Get-NetAdapterAdvancedProperty -Name "<adapter>", which Microsoft describes as getting the advanced properties for a network adapter, and write down the jumbo packet line. Note which adapters carry iSCSI traffic. Confirm a current backup.

Disruptive step: the list below includes restarting the server, updating drivers and firmware, changing an MTU or jumbo frame setting, moving iSCSI traffic to dedicated adapters, and removing a favorite target. A restart drops every session on the server. A wrong MTU or adapter change drops iSCSI sessions on a server that holds data. Microsoft's page gives no back-out for a driver or firmware update. A removed favorite target stops reconnecting until re-added.

Microsoft's resolution steps are:

  • Restart the affected computer or VM and verify that the network adapter is ready.
  • Check switch logs and port counters for anomalies.
  • Make sure MTUs and jumbo frames are consistent end to end.
  • Update network adapter, storage and firmware drivers to the latest vendor-supported versions.
  • If any storage IP address is wrong, remove and re-add the favorite target in iSCSI Initiator.
  • Where the computer is part of a cluster, route iSCSI traffic through dedicated adapters.

To back out a removed favorite target: in iSCSI Initiator select Add and enter the saved target name, portal address and port, then run Get-IscsiSession to check that it reconnects. To back out an MTU change: set the saved MTU value and the saved jumbo packet setting back on the same hop, host adapter, switch port or array port, then run Get-IscsiSession to check that every session is connected. To back out a move to dedicated adapters: rebind iSCSI to the saved adapters. For a driver or firmware update, keep the previous version's installer so that it can be put back. The registry change is the only step here with a command, described next.

Raise the disk timeout (only if the events point to slow responses)

Microsoft's step: in the HKLM\SYSTEM\CurrentControlSet\Services\disk subkey, "set the TimeOutValue value to a larger number, such as 179". The page says to back up the registry first. Microsoft's page does not say whether a restart is needed; NetApp's says: "Note: Remember to reboot the host for the new value to take effect." NetApp's page also says that changing the disk class driver's TimeOutValue "will affect all SCSI requests to the disk device in the host", and recommends SrbTimeoutDelta instead where only disks connected through the Microsoft iSCSI initiator should be affected; Microsoft's page names only TimeOutValue.

Run these commands in an elevated Command Prompt window, not PowerShell, because the file path uses %TEMP%. First save the current state:

reg export HKLM\SYSTEM\CurrentControlSet\Services\disk %TEMP%\disk-key-before.2026-12-02.reg
reg query HKLM\SYSTEM\CurrentControlSet\Services\disk /v TimeOutValue

Write down whether the reg query command returned a value or reported that it was not found, and the value if there was one.

Risk: the next command sets a registry value used by the disk driver, so it can affect every disk on the server, not only iSCSI disks. Microsoft's page gives no figure for what the value was before. NetApp's page says the host must be rebooted for the new value to take effect, so the change means a reboot of a server that holds data, and the undo below needs another.

reg add HKLM\SYSTEM\CurrentControlSet\Services\disk /v TimeOutValue /t REG_DWORD /d 179

If the value already exists, reg add asks whether to overwrite it; the /f switch adds it without prompting, so leave /f off. Reboot the host in a maintenance window for the value to take effect.

To undo it, use the one case that matches what you saved. Reboot the host again after either case.

Case 1, TimeOutValue existed before: run the next command, which puts back every value in the disk key as it was when you exported it, so any other value in that key that changed since the export goes back too:

reg import %TEMP%\disk-key-before.2026-12-02.reg

Case 2, reg query reported that TimeOutValue was not found: run the next command, which names the value so that nothing else is deleted:

reg delete HKLM\SYSTEM\CurrentControlSet\Services\disk /v TimeOutValue

Then run reg query HKLM\SYSTEM\CurrentControlSet\Services\disk /v TimeOutValue to check the result.

Example (illustrative): db01 logs event 20 at 02:14:05 and event 34 at 02:14:09 for the target iqn.2026-12.example.com:array01.lun1 at 198.51.100.20 port 3260. The reconnect took 9 - 5 = 4 seconds. The same pair appears on two nights at 02:14. Get-IscsiSession shows one session with one connection, although the design has two paths. The engineer finds that the second path's switch port uses an MTU of 1500 while the host adapter and the array use 9000, and leaves the registry value alone until the paths match. First the engineer writes down 9000, 1500 and 9000, and in a maintenance window sets the switch port to 9000. To back out, the engineer sets that port back to the saved 1500 and runs Get-IscsiSession.

Confirm the fix

  1. Get-WinEvent with the filter above shows no new event 20 over a period that includes the usual busy time.
  2. Get-IscsiSession shows IsConnected as True for every session, and the connection count matches the design.
  3. Event 157, "Disk X has been surprise removed", no longer appears.
  4. The application owner confirms there are no I/O errors in the application's own log.

What to watch afterwards

  • Keep the event counts per day for events 20, 34, 9 and 39 and compare them after each network, driver or array change.
  • Check after each restart that the iSCSI sessions come back; Microsoft lists adapters or teams not ready at iSCSI start as a cause.
  • Microsoft's page notes that LBFO NIC teaming is deprecated for Windows Server Hyper-V deployments as of Windows Server 2022 and says to use switch embedded teaming instead.

Risks and limits

  • These commands have not been run or lab-tested.
  • Microsoft's page names event numbers for the symptom group but does not print the event 20 text; that text comes from NetApp's knowledge base pages, whose Windows and ONTAP versions are old (last updated 28 September 2023 and 13 May 2020).
  • The timeout figure of 179 is Microsoft's example of "a larger number", not a recommendation for your array. Microsoft's page gives no registry type; REG_DWORD is our choice, and NetApp's older page creates TimeOutValue as a DWord value.
  • Any change to the network, drivers or registry on a server using iSCSI can interrupt storage access.

Sources