connection pool exist after program ends

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

I have a test program that connects to SQL server. All this test program
does is create a connection and then closes the connection. The following
code is a function to create N connections and then close them... testing
the use of the pool which i find it does work as stated in the docs. Now,
the issue i do see is that when i close this program ( windows application )
the connection pool still exists. When i run the program again and do
another test the second instance of the program will create a new connection
pool and then increment the connection counter by N. When this program
exits the connection pool still exists. What i would like to know is why
the connection pool still exists after my program exits. I am checking the
status of the connection pool information via the Performance monitor. I
want to know if i should be worried that the number of connection pools
increase per instance of the application i load. But each instance
correctly pools its own connections in its own connection pool.... help
please!!!

-mark


private void recConnect( int count )
{
SqlConnection tmpConnection = new SqlConnection( conString );
try
{
tmpConnection.Open();
}
catch ( Exception err )
{
textBoxLog.Text += "Connection " + count.ToString() + " " +
err.ToString() + " " + err.Message + Environment.NewLine;
return;
}
if ( count > 0 )
recConnect ( count - 1 );

tmpConnection.Close();
tmpConnection.Dispose();
}
 
Hi Mark,

The SqlClient performance counters are not properly reset. The actual pools
are not being leaked, it's just the perf counter that is not being
decremented.

The following KB article provides more information:
http://support.microsoft.com/default.aspx?scid=kb;en-us;314429


--
Pablo Castro
Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Thank you for the KB article, that does describe the issue. To be honest, I
still have not been able to get my perf counter to reset. I have had the
performance monitor closed since I read the article, about 10 minutes ago.
As long as the issue is with the performance counter and not something that
will affect my program :) i can live with the performance monitor's bug.

-mark
 
Question: How did you test the program? Did you do it interactively in
VS.NET? Try stopping the VS IDE and see if the pool goes away. It's owned by
the process that creates it. When the process dies, so does the pool. While
the perf counters are broken (not resetting correctly), the pooling
mechanism is correctly dropping connections whose parent no longer exists.

--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
You should ignore, both the connections and the pools are absolutely
guaranteed to be released when the process owning them goes away.
 
Back
Top