You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Glenn Nielsen <gl...@voyager.apg.more.net> on 2002/05/15 16:35:13 UTC

[PATCH] DBCP, tracking, reporting, and recovering abandoned connections

I have expanded upon the work James House did to generate stack
traces for abandoned db connections. (Thanks James)

The patch he provided was refactored and some new features added.

Three new DBCP parameters were added:

removeAbandoned - True or false. If true abandoned db connections
are removed after the removeAbandonedTimout is exceeded if the dbcp
is nearing exhaustion.

removeAbandonedTimeout - Time in seconds since a connection was last
used before it is considered abandoned.

logAbandoned - True or false.  If true Exception stack traces are
created so that the source of an abandoned db connection can be logged.

While reviewing the code I noticed that Statements and ResultSets were
not being closed when a Connection was closed (recycled).  This behaviour
differs from the JDBC spec which states that the underlying Statements
and ResultSets should be closed when a Connection is closed.  This 
patch tracks Statements and ResultSets so that when the Connection 
which created them is closed they are closed also.

This patch should be backward compatible with any code which uses
the existing DBCP.

I also have a patch to the Tomcat 4 DbcpDataSourceFactory.java so
that it can use these new features.

I have been running Tomcat 4.1 with this new DBCP code on a production
system with 10-20k DBCP uses per day for the last three days and it
has worked well.

For me, this patch is critical for a production system. It ensures 
that Tomcat and the DBCP can recover from buggy applications which 
sometimes fail to return a db connection to the pool.  In addition
it can point the finger at the buggy application which failed to
return a connection to the pool.

I can post the patch to the list, or if someone wants to grant me
karma for jakarta-commons I can just commit it to CVS.

Regards,

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] DBCP, tracking, reporting, and recovering abandoned connections

Posted by Juozas Baliuka <ba...@centras.lt>.
+1
Yes, the idea is good and I want to see this code in DBCP.
----- Original Message -----
From: "Morgan Delagrange" <md...@yahoo.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Thursday, May 16, 2002 7:07 PM
Subject: Re: [PATCH] DBCP, tracking, reporting, and recovering abandoned
connections


> +1 from me too.
>
> --- Remy Maucherat <re...@apache.org> wrote:
> > > > I can post the patch to the list, or if someone
> > wants to grant me
> > > > karma for jakarta-commons I can just commit it
> > to CVS.
> >
> > +1 for giving you karma.
> >
> > Remy
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
>
> =====
> Morgan Delagrange
> http://jakarta.apache.org/taglibs
> http://jakarta.apache.org/commons
> http://axion.tigris.org
>
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] DBCP, tracking, reporting, and recovering abandoned connections

Posted by Morgan Delagrange <md...@yahoo.com>.
+1 from me too.

--- Remy Maucherat <re...@apache.org> wrote:
> > > I can post the patch to the list, or if someone
> wants to grant me
> > > karma for jakarta-commons I can just commit it
> to CVS.
> 
> +1 for giving you karma.
> 
> Remy
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
Morgan Delagrange
http://jakarta.apache.org/taglibs
http://jakarta.apache.org/commons
http://axion.tigris.org

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] DBCP, tracking, reporting, and recovering abandoned connections

Posted by Remy Maucherat <re...@apache.org>.
> > I can post the patch to the list, or if someone wants to grant me
> > karma for jakarta-commons I can just commit it to CVS.

+1 for giving you karma.

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] DBCP, tracking, reporting, and recovering abandoned connections

Posted by Morgan Delagrange <md...@yahoo.com>.
I'll take it on.  Somehow I didn't see your last post,
but this looks like good functionality.

--- Glenn Nielsen <gl...@voyager.apg.more.net> wrote:
> Is anyone interested in patches for DBCP?
> 
> Glenn Nielsen wrote:
> 
> > I have expanded upon the work James House did to
> generate stack
> > traces for abandoned db connections. (Thanks
> James)
> > 
> > The patch he provided was refactored and some new
> features added.
> > 
> > Three new DBCP parameters were added:
> > 
> > removeAbandoned - True or false. If true abandoned
> db connections
> > are removed after the removeAbandonedTimout is
> exceeded if the dbcp
> > is nearing exhaustion.
> > 
> > removeAbandonedTimeout - Time in seconds since a
> connection was last
> > used before it is considered abandoned.
> > 
> > logAbandoned - True or false.  If true Exception
> stack traces are
> > created so that the source of an abandoned db
> connection can be logged.
> > 
> > While reviewing the code I noticed that Statements
> and ResultSets were
> > not being closed when a Connection was closed
> (recycled).  This behaviour
> > differs from the JDBC spec which states that the
> underlying Statements
> > and ResultSets should be closed when a Connection
> is closed.  This 
> > patch tracks Statements and ResultSets so that
> when the Connection 
> > which created them is closed they are closed also.
> > 
> > This patch should be backward compatible with any
> code which uses
> > the existing DBCP.
> > 
> > I also have a patch to the Tomcat 4
> DbcpDataSourceFactory.java so
> > that it can use these new features.
> > 
> > I have been running Tomcat 4.1 with this new DBCP
> code on a production
> > system with 10-20k DBCP uses per day for the last
> three days and it
> > has worked well.
> > 
> > For me, this patch is critical for a production
> system. It ensures 
> > that Tomcat and the DBCP can recover from buggy
> applications which 
> > sometimes fail to return a db connection to the
> pool.  In addition
> > it can point the finger at the buggy application
> which failed to
> > return a connection to the pool.
> > 
> > I can post the patch to the list, or if someone
> wants to grant me
> > karma for jakarta-commons I can just commit it to
> CVS.
> > 
> > Regards,
> > 
> > Glenn
> > 
> >
>
----------------------------------------------------------------------
> > Glenn Nielsen             glenn@more.net | /*
> Spelin donut madder    |
> > MOREnet System Programming               |  * if
> iz ina coment.      |
> > Missouri Research and Education Network  |  */    
>                   |
> >
>
----------------------------------------------------------------------
> > 
> > --
> > To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> > 
> 
> 
> -- 
>
----------------------------------------------------------------------
> Glenn Nielsen             glenn@more.net | /* Spelin
> donut madder    |
> MOREnet System Programming               |  * if iz
> ina coment.      |
> Missouri Research and Education Network  |  */      
>                 |
>
----------------------------------------------------------------------
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


=====
Morgan Delagrange
http://jakarta.apache.org/taglibs
http://jakarta.apache.org/commons
http://axion.tigris.org

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] DBCP, tracking, reporting, and recovering abandoned connections

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
Is anyone interested in patches for DBCP?

Glenn Nielsen wrote:

> I have expanded upon the work James House did to generate stack
> traces for abandoned db connections. (Thanks James)
> 
> The patch he provided was refactored and some new features added.
> 
> Three new DBCP parameters were added:
> 
> removeAbandoned - True or false. If true abandoned db connections
> are removed after the removeAbandonedTimout is exceeded if the dbcp
> is nearing exhaustion.
> 
> removeAbandonedTimeout - Time in seconds since a connection was last
> used before it is considered abandoned.
> 
> logAbandoned - True or false.  If true Exception stack traces are
> created so that the source of an abandoned db connection can be logged.
> 
> While reviewing the code I noticed that Statements and ResultSets were
> not being closed when a Connection was closed (recycled).  This behaviour
> differs from the JDBC spec which states that the underlying Statements
> and ResultSets should be closed when a Connection is closed.  This 
> patch tracks Statements and ResultSets so that when the Connection 
> which created them is closed they are closed also.
> 
> This patch should be backward compatible with any code which uses
> the existing DBCP.
> 
> I also have a patch to the Tomcat 4 DbcpDataSourceFactory.java so
> that it can use these new features.
> 
> I have been running Tomcat 4.1 with this new DBCP code on a production
> system with 10-20k DBCP uses per day for the last three days and it
> has worked well.
> 
> For me, this patch is critical for a production system. It ensures 
> that Tomcat and the DBCP can recover from buggy applications which 
> sometimes fail to return a db connection to the pool.  In addition
> it can point the finger at the buggy application which failed to
> return a connection to the pool.
> 
> I can post the patch to the list, or if someone wants to grant me
> karma for jakarta-commons I can just commit it to CVS.
> 
> Regards,
> 
> Glenn
> 
> ----------------------------------------------------------------------
> Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
> MOREnet System Programming               |  * if iz ina coment.      |
> Missouri Research and Education Network  |  */                       |
> ----------------------------------------------------------------------
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


-- 
----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [PATCH] DBCP, tracking, reporting, and recovering abandoned connections

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Based on the vote, Glenn now has karma on jakarta-commons and can
commit this directly ... welcome!

Craig


On Wed, 15 May 2002, Glenn Nielsen wrote:

> Date: Wed, 15 May 2002 09:35:13 -0500
> From: Glenn Nielsen <gl...@voyager.apg.more.net>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: commons-dev@jakarta.apache.org
> Subject: [PATCH] DBCP, tracking, reporting,
>      and recovering abandoned connections
>
> I have expanded upon the work James House did to generate stack
> traces for abandoned db connections. (Thanks James)
>
> The patch he provided was refactored and some new features added.
>
> Three new DBCP parameters were added:
>
> removeAbandoned - True or false. If true abandoned db connections
> are removed after the removeAbandonedTimout is exceeded if the dbcp
> is nearing exhaustion.
>
> removeAbandonedTimeout - Time in seconds since a connection was last
> used before it is considered abandoned.
>
> logAbandoned - True or false.  If true Exception stack traces are
> created so that the source of an abandoned db connection can be logged.
>
> While reviewing the code I noticed that Statements and ResultSets were
> not being closed when a Connection was closed (recycled).  This behaviour
> differs from the JDBC spec which states that the underlying Statements
> and ResultSets should be closed when a Connection is closed.  This
> patch tracks Statements and ResultSets so that when the Connection
> which created them is closed they are closed also.
>
> This patch should be backward compatible with any code which uses
> the existing DBCP.
>
> I also have a patch to the Tomcat 4 DbcpDataSourceFactory.java so
> that it can use these new features.
>
> I have been running Tomcat 4.1 with this new DBCP code on a production
> system with 10-20k DBCP uses per day for the last three days and it
> has worked well.
>
> For me, this patch is critical for a production system. It ensures
> that Tomcat and the DBCP can recover from buggy applications which
> sometimes fail to return a db connection to the pool.  In addition
> it can point the finger at the buggy application which failed to
> return a connection to the pool.
>
> I can post the patch to the list, or if someone wants to grant me
> karma for jakarta-commons I can just commit it to CVS.
>
> Regards,
>
> Glenn
>
> ----------------------------------------------------------------------
> Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
> MOREnet System Programming               |  * if iz ina coment.      |
> Missouri Research and Education Network  |  */                       |
> ----------------------------------------------------------------------
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>