You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Frank Nguyen <fr...@sbcglobal.net> on 2008/10/31 19:52:33 UTC

Torque/MySQL connection hung after a week

I use Tomcat 4.x + Torque 3.1.1 + MySQL (5.x). The # of frequent users is <10 but heavy; i.e. continuous 8hrs. My problem is that after a week or so, the db connection b/w Tomcat (Torque) and MySQL hung (Tomcat is still working fine w/ other transaction) and have to reboot. I experienced a lot w/ Torque.properties configuration; especially db-common section, but nothing helped. Attached is my Torque.properties file. Any help/pointers is greatly appreciated.


Frank Nguyen

Re: Torque/MySQL connection hung after a week

Posted by Thomas Fischer <fi...@seitenbau.net>.
This is probably the old mysql problem: Mysql shuts down connections after 
8 hours of inactivity (this is configurable but 8 hours is the standard 
setting). Depending on your pool configuration, it may not notice that the 
connections are dead, and may fail to evict them. In this case Martin's 
solution will do.

There is another possibility that in some rare condition (e.g. exceptions) 
you fail to return connections to the pool. This is hard to find; in this 
case you neet to check that each time a onnection is opened it is closed 
in sole finally clause.
If you do not explicitly use connections then Torque will do this for you.

   Thomas

Martin Tilsted wrote:
> I had a similary problem with torque 3.3, and fixed it with
> 
> torque.dsfactory.YOURDATABASE.pool.validationQuery=SELECT 1
> torque.dsfactory.YOURDATABASE.pool.testOnBorrow=true
> 
> I did a few other things with my code, but I am pretty sure it was these 

> 2 lines that fixed it.
> 
> Frank Nguyen wrote:
> > I use Tomcat 4.x + Torque 3.1.1 + MySQL (5.x). The # of frequent users 

> > is <10 but heavy; i.e. continuous 8hrs. My problem is that after a 
week 
> > or so, the db connection b/w Tomcat (Torque) and MySQL hung (Tomcat is 

> > still working fine w/ other transaction) and have to reboot. I 
> > experienced a lot w/ Torque.properties configuration; especially 
> > db-common section, but nothing helped. Attached is my 
Torque.properties 
> > file. Any help/pointers is greatly appreciated.

Re: Torque/MySQL connection hung after a week

Posted by Martin Tilsted <ti...@daimi.au.dk>.
I had a similary problem with torque 3.3, and fixed it with

torque.dsfactory.YOURDATABASE.pool.validationQuery=SELECT 1
torque.dsfactory.YOURDATABASE.pool.testOnBorrow=true

I did a few other things with my code, but I am pretty sure it was these 
2 lines that fixed it.

Martin


Frank Nguyen wrote:
> I use Tomcat 4.x + Torque 3.1.1 + MySQL (5.x). The # of frequent users 
> is <10 but heavy; i.e. continuous 8hrs. My problem is that after a week 
> or so, the db connection b/w Tomcat (Torque) and MySQL hung (Tomcat is 
> still working fine w/ other transaction) and have to reboot. I 
> experienced a lot w/ Torque.properties configuration; especially 
> db-common section, but nothing helped. Attached is my Torque.properties 
> file. Any help/pointers is greatly appreciated.
> 
> 
> Frank Nguyen
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org