Microsoft KB Archive/830173

= FIX: A pooled connection is not disposed by Microsoft .NET Managed Provider for Oracle when an exception occurs =

Article ID: 830173

Article Last Modified on 12/3/2007

-

APPLIES TO


 * Microsoft .NET Framework 1.1
 * Microsoft .NET Framework 1.1 Service Pack 1

-





SYMPTOMS
OracleConnection objects that experience errors because sessions or connections are dropped are returned to the connection pool when the Connection.Close method is called. Then, the OracleConnection objects are reused. This may cause unexpected behavior.

For example, you may try to connect during a server restart or a connection may be dropped on the network. Although the expected behavior is to discard the bad connection and to try to use a new physical connection, the actual behavior is that the bad connection is reused from the connection pool.

In the Microsoft .NET Framework 1.1, if one or more of the following Oracle error codes are received, the OracleClient data provider does not correctly discard the connection from the connection pool even though the connection is no longer valid:
 * 18
 * 19
 * 24
 * 28
 * 436
 * 1033
 * 1034
 * 1075
 * 3113
 * 3114
 * All errors between 12500 and 12699, inclusive
 * 1012
 * 2399
 * 2392

In the .NET Framework 1.1 Service Pack 1 (SP1), the connection object will be discarded if one or more of these error codes are encountered except for the following error codes:
 * 1012
 * 2399
 * 2392

If you experience one of these three error codes, you must apply this hotfix.

For a description of the Oracle error codes, see your Oracle documentation.

Note The hotfix that is described in this article does not prevent the original cause of these errors. However, when these Oracle errors are encountered on a connection, the hotfix lets that connection be correctly removed from the pool so that it is not reused.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

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.

Service pack information
Note All error codes except for the following were handled correctly and were fixed in the .NET Framework 1.1 SP1:
 * 1012
 * 2399
 * 2392

We recommend that you install the .NET Framework 1.1 SP1 to fix this problem because service packs are tested more rigorously than hotfixes. However, if you experience one or more of these three Oracle error codes, you must apply this hotfix. In that case, obtain the hotfix by contacting Microsoft Product Support Services. Applying this hotfix will make sure that the connections that experience these errors are not pooled and reused.

For additional information about the .NET Framework 1.1 Service Pack 1, click the following article number to view the article in the Microsoft Knowledge Base:

885055 How to obtain Microsoft .NET Framework 1.1 Service Pack 1

Hotfix 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 tool in Control Panel.

The .NET Framework 1.1 RTM
  Date         Time   Version        Size       File name 24-May-2004 20:47  1.1.4322.1046    303,104  System.data.oracleclient.dll 26-May-2004 00:50  1.0.859.2574   1,126,192  Ndp1.1-kb830173-x86.exe 27-May-2004 22:54  5.4.15.0         465,648  Windowsserver2003-kb830173-x86-enu.exe 14-Oct-2003 16:55  1.1.4322.957     303,104  System.data.oracleclient.dll 15-Oct-2003 00:58  1.0.0.0        1,072,808  Ndp1.1-kb830173-x86.exe 17-Oct-2003 23:00                   989,452  Ndp1.1-kb830173-x86.zip

The .NET Framework 1.1 SP1
  Date         Time   Version        Size     File name --  23-Oct-2004  02:01  1.1.4322.2038  303,104  System.data.oracleclient.dll 14-Oct-2004 22:59  1.0.1045.3098  966,432  Ndp1.1sp1-kb887548-x86.exe 24-Oct-2004 01:30  1.0.0.0        485,104  Windowsserver2003-kb887548-x86-enu.exe 24-Oct-2004 01:30  1.0.0.0        484,080  Windowsserver2003-kb887548-x86-kor.exe



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the behavior
The following series demonstrates that even after a .NET application is disconnected from the Oracle server, the Microsoft .NET Managed Provider for Oracle does not dispose the connection from the connection pool:
 * 1) Create an ADO.NET application that uses the Microsoft Oracle .NET Provider to access the Oracle back-end, compile, and then run the application.
 * 2) Connect to the Oracle Server by using the ADO.NET application that you created in step 1.
 * 3) Close the Oracle connection by stopping the Oracle server or by disconnecting the client from the physical network.

The expected behavior is that the application receives an error that indicates that the session has been terminated and that the connection must be discarded from the pool. The next time that you open a connection, you expect to use a new physical connection to the server.

However, the actual behavior is that the connection that encounters the problem is returned to the Oracle client pool. This connection can later be retrieved from the pool for the .NET application the next time that the application tries to open a connection to the server.

