Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: TCP port is not closed when you use System.Data.SqlClient to connect to a database that has database mirroring configured and a failover occurs


Symptoms

Consider the following scenario:
  • You configure database mirroring between two instances of Microsoft SQL Server.

    Note One instance is the principal server instance that contains the principal database, and the other instance is the mirror server instance that contains the mirror database.
  • You run a Microsoft .NET Framework 2.0–based application that uses the .NET Framework Data Provider for SQL Server (System.Data.SqlClient) to connect to the principle database from a client computer.
  • A TCP port is used to establish a connection to the principal server instance from the client computer.
  • You specify the failover partner in the connection string.

    For example, you use the following code to configure the connection string:
    Data Source=<principal server instance>;Failover Partner=<mirror server instance>;Initial 
    Catalog=<database name>;Integrated Security=True;Network Library=dbmssocn
  • You perform a failover operation from the principal server instance to the mirror server instance.
In this scenario, the TCP port that is used to establish connection for the principal server instance on the client computer is not closed. Therefore, a new TCP port is used to establish a connection for the mirror server instance on the client computer.

Additionally, the TCP port for the principle server instance is set to the CLOSE_WAIT state on the client computer, and the corresponding TCP port is set to the FIN_WAIT_2 state on the principal server. If failover operations occur many times, all the ports of the client computer may be unavailable.

Note To check active connections, open a command prompt, type the following command, and the press Enter:
NetStat -n

↑ Back to the top


Cause

The issue occurs because the .NET Framework Data Provider for SQL Server does not close the connection correctly after a failover occurs.

Note The connection can be released only by garbage collection.

↑ Back to the top


Resolution

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft website:Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

To apply this hotfix, you must have the Microsoft .NET Framework 3.5.1 installed on a computer that is running one of the following operating systems:
  • Windows 7
  • Windows Server 2008 R2

Restart requirement

You do not have to restart the computer after you apply this hotfix.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.

For all supported x86-based versions of Windows 7

File nameFile versionFile sizeDateTimePlatform
System.data.dll2.0.50727.56642,927,61615-Apr-201122:32x86
For all supported x64-based versions of Windows 7 and of Windows Server 2008 R2
File nameFile versionFile sizeDateTimePlatform
System.data.dll2.0.50727.56643,096,06415-Apr-201122:28x64
System.data.dll2.0.50727.56642,927,61615-Apr-201122:32x86
For all supported IA-64–based versions of Windows Server 2008 R2
File nameFile versionFile sizeDateTimePlatform
System.data.dll2.0.50727.56643,234,81615-Apr-201122:23IA-64
System.data.dll2.0.50727.56642,927,61615-Apr-201122:32x86

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


References

For more information about TCP connection states and Netstat output, click the following article number to view the article in the Microsoft Knowledge Base:
137984 TCP Connection States and Netstat Output
For more information about how to use database mirroring, visit the following MSDN website:For more information about how to make the initial connection to a database mirroring session, visit the following MSDN website:

↑ Back to the top


Keywords: kbqfe, kbhotfixserver, kbfix, kbexpertiseadvanced, kbsurveynew, kb

↑ Back to the top

Article Info
Article ID : 2527496
Revision : 1
Created on : 1/7/2017
Published on : 5/17/2011
Exists online : False
Views : 87