Connection timeout in Debug but not Release

P

Paul Hatcher

I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal operation
exception in System.Data" with a further note that it's
likely to be the connection pool being full.

A few points...

1. If I run this in Release mode, the problem goes away.
2. If I profile the connection pool, it never goes above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection objects
to ensure that they return to the connection pool.

This is in .NET 1.1 Framework - I didn't have this problem
with the same application under 1.0 so I'm think it's a
bug of some sort.

TIA

Paul
 
P

Paul Hatcher

Angel

The provide is SqlClient and the code is as below...

Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As Integer
Try
' Open the connection
connection.Open()

' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State = ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function

Full error message as follows...

An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll

Additional information: Timeout expired. The timeout
period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

The code, which is from my library, is running fine in a
number of large applications.

Paul
-----Original Message-----
What provider are you using, do you have some code?
Thanks

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal operation
exception in System.Data" with a further note that it's
likely to be the connection pool being full.

A few points...

1. If I run this in Release mode, the problem goes away.
2. If I profile the connection pool, it never goes above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection objects
to ensure that they return to the connection pool.

This is in .NET 1.1 Framework - I didn't have this problem
with the same application under 1.0 so I'm think it's a
bug of some sort.

TIA

Paul


.
 
A

Angel Saenz-Badillos[MS]

Paul,
The code looks really good, a very nice way to use ado.net imho.
Minor comments would be to remove the
If connection.State = ConnectionState.Open
this is not necesary since closing a closed connection is not a problem.

You may want to switch the dispose order
connection.Dispose()
command.Dispose()
To
command.Dispose()
connection.Dispose()


The exception you are getting would seem to indicate that connections are
not being disposed, this does not look possible given your code. My only
concern is that for some reason you are throwing an exception inside of the
Finally clause and close and dispose are not getting called. The other
posibility would be that debug mode of Visual Studio is leaking

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

Paul Hatcher said:
Angel

The provide is SqlClient and the code is as below...

Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As Integer
Try
' Open the connection
connection.Open()

' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State = ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function

Full error message as follows...

An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll

Additional information: Timeout expired. The timeout
period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

The code, which is from my library, is running fine in a
number of large applications.

Paul
-----Original Message-----
What provider are you using, do you have some code?
Thanks

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal operation
exception in System.Data" with a further note that it's
likely to be the connection pool being full.

A few points...

1. If I run this in Release mode, the problem goes away.
2. If I profile the connection pool, it never goes above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection objects
to ensure that they return to the connection pool.

This is in .NET 1.1 Framework - I didn't have this problem
with the same application under 1.0 so I'm think it's a
bug of some sort.

TIA

Paul


.
 
P

Paul Hatcher

Angel

I did the simple changes you suggested with no effect.

I believe it must be the IDE leaking, since I did not have
the same problem under VS 2002.

What I'll try to do is reproduce it with some queries
against pubs, then I can attempt to report it as a bug :)

Glad you like the design, it means that I can do cross-
database development very easily.

Paul
-----Original Message-----
Paul,
The code looks really good, a very nice way to use ado.net imho.
Minor comments would be to remove the
If connection.State = ConnectionState.Open
this is not necesary since closing a closed connection is not a problem.

You may want to switch the dispose order
connection.Dispose()
command.Dispose()
To
command.Dispose()
connection.Dispose()


The exception you are getting would seem to indicate that connections are
not being disposed, this does not look possible given your code. My only
concern is that for some reason you are throwing an exception inside of the
Finally clause and close and dispose are not getting called. The other
posibility would be that debug mode of Visual Studio is leaking

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

Angel

The provide is SqlClient and the code is as below...

Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As Integer
Try
' Open the connection
connection.Open()

' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State = ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function

Full error message as follows...

An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll

Additional information: Timeout expired. The timeout
period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

The code, which is from my library, is running fine in a
number of large applications.

Paul and
confers no rights.


.
 
V

VBM

Hello

I am also facing the same leak problem. When I debug it says connection pool
relater error, connections exceeded. I am using ASP.NET, SQL Server, ADO.NET
and my code is using cross database in middle tier.

I am also using Dispose function and explicitely Disposing connections
rather waiting for garbage collecor.

Has somebody confirmed that its VS2003 bug? leaking etc.

thanks



Paul said:
Angel

I did the simple changes you suggested with no effect.

I believe it must be the IDE leaking, since I did not have
the same problem under VS 2002.

What I'll try to do is reproduce it with some queries
against pubs, then I can attempt to report it as a bug :)

Glad you like the design, it means that I can do cross-
database development very easily.

Paul
-----Original Message-----
Paul,
The code looks really good, a very nice way to use ado.net imho.
Minor comments would be to remove the
If connection.State = ConnectionState.Open
this is not necesary since closing a closed connection is not a
problem.

You may want to switch the dispose order
connection.Dispose()
command.Dispose()
To
command.Dispose()
connection.Dispose()


The exception you are getting would seem to indicate that
connections are not being disposed, this does not look possible
given your code. My only concern is that for some reason you are
throwing an exception inside of the Finally clause and close and
dispose are not getting called. The other posibility would be that
debug mode of Visual Studio is leaking

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights. Please do not send email directly to this alias. This alias
is for newsgroup purposes only.

Paul Hatcher said:
Angel

The provide is SqlClient and the code is as below...

Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As Integer
Try
' Open the connection
connection.Open()

' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State = ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function

Full error message as follows...

An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll

Additional information: Timeout expired. The timeout
period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

The code, which is from my library, is running fine in a
number of large applications.

Paul
-----Original Message-----
What provider are you using, do you have some code?
Thanks

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers
no rights. Please do not send email directly to this alias. This
alias is for newsgroup purposes only.

message I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal operation
exception in System.Data" with a further note that it's
likely to be the connection pool being full.

A few points...

1. If I run this in Release mode, the problem goes away.
2. If I profile the connection pool, it never goes above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection objects
to ensure that they return to the connection pool.

This is in .NET 1.1 Framework - I didn't have this problem
with the same application under 1.0 so I'm think it's a
bug of some sort.

TIA

Paul


.


.
 
W

William \(Bill\) Vaughn

I do not recommend use of Dispose to close the connection. I suspect that
you're leaking connections and overflowing the pool. Make doubly sure that
you're closing the connections you open while they're still in scope or if
you're using a DataReader, make sure you use CommandBehavior.CloseConnection
AND close the DataReader before it falls from scope.

hth

--
____________________________________
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.
__________________________________

VBM said:
Hello

I am also facing the same leak problem. When I debug it says connection pool
relater error, connections exceeded. I am using ASP.NET, SQL Server, ADO.NET
and my code is using cross database in middle tier.

I am also using Dispose function and explicitely Disposing connections
rather waiting for garbage collecor.

Has somebody confirmed that its VS2003 bug? leaking etc.

thanks



Paul said:
Angel

I did the simple changes you suggested with no effect.

I believe it must be the IDE leaking, since I did not have
the same problem under VS 2002.

What I'll try to do is reproduce it with some queries
against pubs, then I can attempt to report it as a bug :)

Glad you like the design, it means that I can do cross-
database development very easily.

Paul
-----Original Message-----
Paul,
The code looks really good, a very nice way to use ado.net imho.
Minor comments would be to remove the
If connection.State = ConnectionState.Open
this is not necesary since closing a closed connection is not a
problem.

You may want to switch the dispose order
connection.Dispose()
command.Dispose()
To
command.Dispose()
connection.Dispose()


The exception you are getting would seem to indicate that
connections are not being disposed, this does not look possible
given your code. My only concern is that for some reason you are
throwing an exception inside of the Finally clause and close and
dispose are not getting called. The other posibility would be that
debug mode of Visual Studio is leaking

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights. Please do not send email directly to this alias. This alias
is for newsgroup purposes only.

Angel

The provide is SqlClient and the code is as below...

Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As Integer
Try
' Open the connection
connection.Open()

' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State = ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function

Full error message as follows...

An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll

Additional information: Timeout expired. The timeout
period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

The code, which is from my library, is running fine in a
number of large applications.

Paul
-----Original Message-----
What provider are you using, do you have some code?
Thanks

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers
no rights. Please do not send email directly to this alias. This
alias is for newsgroup purposes only.

message I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal operation
exception in System.Data" with a further note that it's
likely to be the connection pool being full.

A few points...

1. If I run this in Release mode, the problem goes away.
2. If I profile the connection pool, it never goes above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection objects
to ensure that they return to the connection pool.

This is in .NET 1.1 Framework - I didn't have this problem
with the same application under 1.0 so I'm think it's a
bug of some sort.

TIA

Paul


.



.
 
V

VBM

Yes I am closing the connections....my custom Dispose is called at the end
of the method.....also I am using CommandBehavior.CloseConnection

Code looks good as per my info...still I will cross check again.....

I am using this way f coding (like explicitely closing connection) becoz I
have other databases the same code running need explicitely closed
connections ...
I do not recommend use of Dispose to close the connection. I suspect
that you're leaking connections and overflowing the pool. Make doubly
sure that you're closing the connections you open while they're still
in scope or if you're using a DataReader, make sure you use
CommandBehavior.CloseConnection AND close the DataReader before it
falls from scope.

hth


VBM said:
Hello

I am also facing the same leak problem. When I debug it says
connection pool relater error, connections exceeded. I am using
ASP.NET, SQL Server, ADO.NET and my code is using cross database in
middle tier.

I am also using Dispose function and explicitely Disposing
connections rather waiting for garbage collecor.

Has somebody confirmed that its VS2003 bug? leaking etc.

thanks



Paul said:
Angel

I did the simple changes you suggested with no effect.

I believe it must be the IDE leaking, since I did not have
the same problem under VS 2002.

What I'll try to do is reproduce it with some queries
against pubs, then I can attempt to report it as a bug :)

Glad you like the design, it means that I can do cross-
database development very easily.

Paul
-----Original Message-----
Paul,
The code looks really good, a very nice way to use ado.net imho.
Minor comments would be to remove the
If connection.State = ConnectionState.Open
this is not necesary since closing a closed connection is not a
problem.

You may want to switch the dispose order
connection.Dispose()
command.Dispose()
To
command.Dispose()
connection.Dispose()


The exception you are getting would seem to indicate that
connections are not being disposed, this does not look possible
given your code. My only concern is that for some reason you are
throwing an exception inside of the Finally clause and close and
dispose are not getting called. The other posibility would be that
debug mode of Visual Studio is leaking

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers
no rights. Please do not send email directly to this alias. This
alias
is for newsgroup purposes only.

message Angel

The provide is SqlClient and the code is as below...

Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As Integer
Try
' Open the connection
connection.Open()

' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State = ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function

Full error message as follows...

An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll

Additional information: Timeout expired. The timeout
period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

The code, which is from my library, is running fine in a
number of large applications.

Paul
-----Original Message-----
What provider are you using, do you have some code?
Thanks

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers
no rights. Please do not send email directly to this alias. This
alias is for newsgroup purposes only.

message I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal operation
exception in System.Data" with a further note that it's
likely to be the connection pool being full.

A few points...

1. If I run this in Release mode, the problem goes away.
2. If I profile the connection pool, it never goes above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection objects
to ensure that they return to the connection pool.

This is in .NET 1.1 Framework - I didn't have this problem
with the same application under 1.0 so I'm think it's a
bug of some sort.

TIA

Paul


.



.
 
A

Angel Saenz-Badillos[MS]

I am very interested in finding out if there is a leak here, I have seen an
IDE leak happen with a different provider so it is possible. I will try to
set it up using the information you have posted, please let me know if you
find any more information.

Thanks,
--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

Paul Hatcher said:
Angel

I did the simple changes you suggested with no effect.

I believe it must be the IDE leaking, since I did not have
the same problem under VS 2002.

What I'll try to do is reproduce it with some queries
against pubs, then I can attempt to report it as a bug :)

Glad you like the design, it means that I can do cross-
database development very easily.

Paul
-----Original Message-----
Paul,
The code looks really good, a very nice way to use ado.net imho.
Minor comments would be to remove the
If connection.State = ConnectionState.Open
this is not necesary since closing a closed connection is not a problem.

You may want to switch the dispose order
connection.Dispose()
command.Dispose()
To
command.Dispose()
connection.Dispose()


The exception you are getting would seem to indicate that connections are
not being disposed, this does not look possible given your code. My only
concern is that for some reason you are throwing an exception inside of the
Finally clause and close and dispose are not getting called. The other
posibility would be that debug mode of Visual Studio is leaking

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

Angel

The provide is SqlClient and the code is as below...

Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As Integer
Try
' Open the connection
connection.Open()

' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State = ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function

Full error message as follows...

An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll

Additional information: Timeout expired. The timeout
period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

The code, which is from my library, is running fine in a
number of large applications.

Paul
-----Original Message-----
What provider are you using, do you have some code?
Thanks

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and
confers no rights.
Please do not send email directly to this alias. This
alias is for newsgroup
purposes only.

"Paul Hatcher" <[email protected]>
wrote in message
I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal operation
exception in System.Data" with a further note that it's
likely to be the connection pool being full.

A few points...

1. If I run this in Release mode, the problem goes away.
2. If I profile the connection pool, it never goes
above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection
objects
to ensure that they return to the connection pool.

This is in .NET 1.1 Framework - I didn't have this
problem
with the same application under 1.0 so I'm think it's a
bug of some sort.

TIA

Paul


.


.
 
P

Paul Hatcher

Angel

I can't easily reproduce this elsewhere...

My app is erroring whilst attempting the 101st database
access which does tend to imply the pool is consumed..

However, if I set up a small test project using my library
talking to pubs, it works.

If I modify my original program to just issue calls to a
particular stored procedure, it fails on the 101 attempt -
if I do the same in my small test app, it works ok!

During all of this the Performance Monitor indication of
the pool size is not moving above 1 and the number of
pools is 1 as well.

Any other ideas?

Paul
-----Original Message-----
I am very interested in finding out if there is a leak here, I have seen an
IDE leak happen with a different provider so it is possible. I will try to
set it up using the information you have posted, please let me know if you
find any more information.

Thanks,
--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

Angel

I did the simple changes you suggested with no effect.

I believe it must be the IDE leaking, since I did not have
the same problem under VS 2002.

What I'll try to do is reproduce it with some queries
against pubs, then I can attempt to report it as a bug :)

Glad you like the design, it means that I can do cross-
database development very easily.

Paul is
not a problem. that
connections are and
confers no rights. warranties,
and


.
 
A

Angel Saenz-Badillos[MS]

Hmm the client side performance counters are not the most reliable way to
track these type of issues
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q314429

Can you try tracking this using Sql Profiler or the server side performance
counters?
--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

Paul Hatcher said:
Angel

I can't easily reproduce this elsewhere...

My app is erroring whilst attempting the 101st database
access which does tend to imply the pool is consumed..

However, if I set up a small test project using my library
talking to pubs, it works.

If I modify my original program to just issue calls to a
particular stored procedure, it fails on the 101 attempt -
if I do the same in my small test app, it works ok!

During all of this the Performance Monitor indication of
the pool size is not moving above 1 and the number of
pools is 1 as well.

Any other ideas?

Paul
-----Original Message-----
I am very interested in finding out if there is a leak here, I have seen an
IDE leak happen with a different provider so it is possible. I will try to
set it up using the information you have posted, please let me know if you
find any more information.

Thanks,
--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no rights.
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

Angel

I did the simple changes you suggested with no effect.

I believe it must be the IDE leaking, since I did not have
the same problem under VS 2002.

What I'll try to do is reproduce it with some queries
against pubs, then I can attempt to report it as a bug :)

Glad you like the design, it means that I can do cross-
database development very easily.

Paul
-----Original Message-----
Paul,
The code looks really good, a very nice way to use
ado.net imho.
Minor comments would be to remove the
If connection.State = ConnectionState.Open
this is not necesary since closing a closed connection is
not a problem.

You may want to switch the dispose order
connection.Dispose()
command.Dispose()
To
command.Dispose()
connection.Dispose()


The exception you are getting would seem to indicate that
connections are
not being disposed, this does not look possible given
your code. My only
concern is that for some reason you are throwing an
exception inside of the
Finally clause and close and dispose are not getting
called. The other
posibility would be that debug mode of Visual Studio is
leaking

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and
confers no rights.
Please do not send email directly to this alias. This
alias is for newsgroup
purposes only.

"Paul Hatcher" <[email protected]>
wrote in message
Angel

The provide is SqlClient and the code is as below...

Public Function ExecuteNonQuery(ByVal connection
As IDbConnection, ByVal command As IDbCommand) As
Integer
Try
' Open the connection
connection.Open()

' Try to run the command
Trace.WriteLineIf
(DataSwitch.TraceVerbose, "Executing " +
command.CommandText, "SQL")
Return command.ExecuteNonQuery()
Catch ex As Exception
' Just rethrow for now, but gives us a
breakpoint
Throw
Finally
' Tidy up
If connection.State =
ConnectionState.Open
Then
connection.Close()
End If
connection.Dispose()
command.Dispose()
End Try
End Function

Full error message as follows...

An unhandled exception of
type 'System.InvalidOperationException' occurred in
cs.datalayer2003.dll

Additional information: Timeout expired. The timeout
period elapsed prior to obtaining a connection from the
pool. This may have occurred because all pooled
connections were in use and max pool size was reached.

The code, which is from my library, is running fine in a
number of large applications.

Paul
-----Original Message-----
What provider are you using, do you have some code?
Thanks

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties,
and
confers no rights.
Please do not send email directly to this alias. This
alias is for newsgroup
purposes only.

"Paul Hatcher" <[email protected]>
wrote in message
I have one application at the moment that's behaving
oddly. When I run it in debug mode after a few SQL
statements have been issued, I get an "Illegal
operation
exception in System.Data" with a further note that
it's
likely to be the connection pool being full.

A few points...

1. If I run this in Release mode, the problem goes
away.
2. If I profile the connection pool, it never goes
above 7
and I believe the default pool size to be 100.
3. I'm very carefully disposing of all connection
objects
to ensure that they return to the connection pool.

This is in .NET 1.1 Framework - I didn't have this
problem
with the same application under 1.0 so I'm think
it's a
bug of some sort.

TIA

Paul


.



.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top