Connecting Tech Pros Worldwide Forums | Help | Site Map

Problem with connection pool

DaM
Guest
 
Posts: n/a
#1: Nov 19 '05
Hi guys,

I'm having this problem with my ASP.Net application:

I was testing the whole site, and it seem to work fine. Fast and
stable, but suddenly it stopped working and this error occurred:

"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."

What could be the cause? Every time I use a dataReader I'm pretty sure
I'm closing it.

Thanks in advance,
Dam


Milosz Skalecki
Guest
 
Posts: n/a
#2: Nov 19 '05

re: Problem with connection pool


Hi,

Seems all connections in the pool are in use. You can control the number of
connections in the pool changing connection string. For MSSQL, use mix pool
size= and max pool size=
Visit
http://msdn.microsoft.com/library/de...taprovider.asp
for more info. Also make sure you're closing reader/connection as soon as
the data has been populated/retreived.


--
Milosz Skalecki
MCP, MCAD


"DaM" wrote:
[color=blue]
> Hi guys,
>
> I'm having this problem with my ASP.Net application:
>
> I was testing the whole site, and it seem to work fine. Fast and
> stable, but suddenly it stopped working and this error occurred:
>
> "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."
>
> What could be the cause? Every time I use a dataReader I'm pretty sure
> I'm closing it.
>
> Thanks in advance,
> Dam
>
>[/color]
Karl Seguin
Guest
 
Posts: n/a
#3: Nov 19 '05

re: Problem with connection pool


Make sure you are closing both your connection and your datareader.

Make sure you are doing this in the Finally block

run sp_who in SQL Server to see who's connected

Check out:
http://www.15seconds.com/issue/040830.htm

for more ideas...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)


"DaM" <dlobalzo@gmail.com> wrote in message
news:1125638864.509592.239030@o13g2000cwo.googlegr oups.com...[color=blue]
> Hi guys,
>
> I'm having this problem with my ASP.Net application:
>
> I was testing the whole site, and it seem to work fine. Fast and
> stable, but suddenly it stopped working and this error occurred:
>
> "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."
>
> What could be the cause? Every time I use a dataReader I'm pretty sure
> I'm closing it.
>
> Thanks in advance,
> Dam
>[/color]


Milosz Skalecki
Guest
 
Posts: n/a
#4: Nov 19 '05

re: Problem with connection pool


Sorry, not "mix pool size" but "max pool size" :D
--
Milosz Skalecki
MCP, MCAD


"Milosz Skalecki" wrote:
[color=blue]
> Hi,
>
> Seems all connections in the pool are in use. You can control the number of
> connections in the pool changing connection string. For MSSQL, use mix pool
> size= and max pool size=
> Visit
> http://msdn.microsoft.com/library/de...taprovider.asp
> for more info. Also make sure you're closing reader/connection as soon as
> the data has been populated/retreived.
>
>
> --
> Milosz Skalecki
> MCP, MCAD
>
>
> "DaM" wrote:
>[color=green]
> > Hi guys,
> >
> > I'm having this problem with my ASP.Net application:
> >
> > I was testing the whole site, and it seem to work fine. Fast and
> > stable, but suddenly it stopped working and this error occurred:
> >
> > "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."
> >
> > What could be the cause? Every time I use a dataReader I'm pretty sure
> > I'm closing it.
> >
> > Thanks in advance,
> > Dam
> >
> >[/color][/color]
Kevin Spencer
Guest
 
Posts: n/a
#5: Nov 19 '05

re: Problem with connection pool


Hi Dam,

First of all, "pretty sure" is never sure enough! But let's assume for a
moment that you ARE closing all of your DataReaders.

There are a limited number of database connections available in any
Connection Pool. These Connections are created as needed, until the Maximum
Pool Size is reached. There is one Connection Pool created for each unique
Connection String used. When a database operation is requested, the
Connection String used is checked against the available Connection Pools. If
an existing Connection is available, it is re-used. If there are no
Connections available, the request is queued until either a Connection is
released, or the Timeout period expires.

A Connection is released not by closing a DataReader only, but by closing a
Connection object. Closing a DataReader releases the Connection object from
the DataReader, but does not close it. A Connection is released when you
call Close or Dispose on the Connection object.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"DaM" <dlobalzo@gmail.com> wrote in message
news:1125638864.509592.239030@o13g2000cwo.googlegr oups.com...[color=blue]
> Hi guys,
>
> I'm having this problem with my ASP.Net application:
>
> I was testing the whole site, and it seem to work fine. Fast and
> stable, but suddenly it stopped working and this error occurred:
>
> "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."
>
> What could be the cause? Every time I use a dataReader I'm pretty sure
> I'm closing it.
>
> Thanks in advance,
> Dam
>[/color]


Milosz Skalecki
Guest
 
Posts: n/a
#6: Nov 19 '05

re: Problem with connection pool


You can always use ExecuteReader(CommandBehaviour.Close) to close connection
automatically when calling IdbDataReader.Close().

--
Milosz Skalecki
MCP, MCAD


"Kevin Spencer" wrote:
[color=blue]
> Hi Dam,
>
> First of all, "pretty sure" is never sure enough! But let's assume for a
> moment that you ARE closing all of your DataReaders.
>
> There are a limited number of database connections available in any
> Connection Pool. These Connections are created as needed, until the Maximum
> Pool Size is reached. There is one Connection Pool created for each unique
> Connection String used. When a database operation is requested, the
> Connection String used is checked against the available Connection Pools. If
> an existing Connection is available, it is re-used. If there are no
> Connections available, the request is queued until either a Connection is
> released, or the Timeout period expires.
>
> A Connection is released not by closing a DataReader only, but by closing a
> Connection object. Closing a DataReader releases the Connection object from
> the DataReader, but does not close it. A Connection is released when you
> call Close or Dispose on the Connection object.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> ..Net Developer
> Neither a follower nor a lender be.
>
> "DaM" <dlobalzo@gmail.com> wrote in message
> news:1125638864.509592.239030@o13g2000cwo.googlegr oups.com...[color=green]
> > Hi guys,
> >
> > I'm having this problem with my ASP.Net application:
> >
> > I was testing the whole site, and it seem to work fine. Fast and
> > stable, but suddenly it stopped working and this error occurred:
> >
> > "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."
> >
> > What could be the cause? Every time I use a dataReader I'm pretty sure
> > I'm closing it.
> >
> > Thanks in advance,
> > Dam
> >[/color]
>
>
>[/color]
Closed Thread