Troubleshooting: Connection Forcibly Closed

This error may occur when connecting to SQL Server using TCP/IP.

Error Text

The error can occur in the following formats:

  • TCP_PROV: An existing connection was forcibly closed by the remote host.

  • "ProviderNum: 7, Error: 10054, ErrorMessage: "TCP Provider: An existing connection was forcibly closed by the remote host ..."

  • Unhandled Exception: A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

Typical Causes of This Error

The following table lists typical causes and resolutions for this error.

Cause

Resolution

Client is connecting with an unsupported version of the SQL Server Native Client.

Update the client computer to the server version of the SQL Server Native Client.

Faulty network hardware is dropping portions of the TCP traffic.

Use network monitoring programs to analyze TCP SYN, ACK, and FIN messages.

The SynAttackProtect setting may be dropping connections.

See the section "Connections May Be Forcibly Closed When Running on Windows Server 2003 SP1" that follows.

Connections May Be Forcibly Closed When Running on Windows Server 2003 SP1

When testing scalability with a large number of client connection attempts to an instance of the SQL Server Database Engine running on Windows Server 2003 Service Pack 1 and later, Windows may drop connections if the requests arrive faster than SQL Server can service them. This is a security feature of Windows Server 2003 Service Pack 1 and later, which implements a finite queue for incoming TCP connection requests.

To resolve this issue, use the regedit.exe utility to add the following registry key:

Key

Type

Name

Value

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\

DWORD

SynAttackProtect

00000000

Security noteSecurity Note

Setting this registry key may expose the server to a SYN flood, denial-of-service attack. Add this registry value only if necessary and with an understanding of the security risks. Remove this registry value when testing is complete.

See Also

Concepts