AW: Could not retrieve connection info from pool

2007-05-02 Thread Thoralf Rickert
Hi!

Is it possible, that your application uses many transactions? If you forget to 
close this connections - the pool is running out of connections from time to 
time. Maybe there is just one unclosed transaction somewhere in your 
application. If you have a lot of traffic on your site you can increase the 
number of max connections...but I'm sure there is missing commit() or 
safeRollback().

bye
Thoralf

 -Ursprüngliche Nachricht-
 Von: Eduardo Kinto [mailto:[EMAIL PROTECTED] 
 Gesendet: Mittwoch, 2. Mai 2007 13:09
 An: torque-user@db.apache.org
 Betreff: Could not retrieve connection info from pool
 
 
 Hello,
 
 I'm using Torque to connect to my MSSql and MySQL Server database.
 
 Everything is working fine, just one problem, some times 
 Database connection fail and don't come back (both, mysql and 
 mssql) by it self and I have to restart my webserver (where 
 it is running my application).
 
 Running the command netstat, I can't see any connnection to 
 database server.
 
 I'm using:
 - torque-3.2.jar
 - apache tomcat 5.5.12
 - java jdk 1.5.0_06
 - RedHat Linux Enterprise 4
 
 And the folowing torque setup for mysql:
 
 torque.dsfactory.APP.factory = 
 org.apache.torque.dsfactory.SharedPoolDataSourceFactory
 torque.dsfactory.APP.connection.driver = 
 com.mysql.jdbc.Driver torque.dsfactory.APP.connection.url = 
 jdbc:mysql://IP:PORT/APP?autoReconnect=true
 torque.dsfactory.APP.connection.user = yyy 
 torque.dsfactory.APP.connection.password = xxx 
 torque.dsfactory.APP.pool.defaultTransactionIsolation=1
 torque.dsfactory.APP.pool.maxWait=60
 torque.dsfactory.APP.pool.maxActive=32
 torque.dsfactory.APP.pool.maxIdle=32
 torque.dsfactory.APP.pool.testOnBorrow=true
 torque.dsfactory.APP.pool.validationQuery=SELECT 1
 
 And for MSSqlServer:
 torque.dsfactory.APP2.factory = 
 org.apache.torque.dsfactory.SharedPoolDataSourceFactory
 torque.dsfactory.APP2.connection.driver = 
 net.sourceforge.jtds.jdbc.Driver 
 torque.dsfactory.APP2.connection.url = 
 jdbc:jtds:sqlserver://IP:1433/DATABASE
 .. similary to mysql ...
 
 The ERROR message:
 org.apache.torque.TorqueException: 
 org.apache.commons.dbcp.SQLNestedException: Could not 
 retrieve connection info from pool
 at 
 org.apache.torque.TorqueInstance.getConnection(TorqueInstance.
 java:825)
 at org.apache.torque.Torque.getConnection(Torque.java:272)
 at 
 org.apache.torque.util.BasePeer.doPSSelect(BasePeer.java:1478)
 ... 
 Caused by: org.apache.commons.dbcp.SQLNestedException: Could 
 not retrieve connection info from pool
 at 
 org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPo
 oledConnectionAndInfo(SharedPoolDataSource.java:169)
 at 
 org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getC
 onnection(InstanceKeyDataSource.java:631)
 at 
 org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getC
 onnection(InstanceKeyDataSource.java:615)
 at 
 org.apache.torque.TorqueInstance.getConnection(TorqueInstance.
 java:821)
 ... 11 more
 Caused by: java.lang.NullPointerException
 at 
 org.apache.commons.collections.SequencedHashMap.removeEntry(Se
 quencedHashMap.java:215)
 at 
 org.apache.commons.collections.SequencedHashMap.removeImpl(Seq
 uencedHashMap.java:473)
 at 
 org.apache.commons.collections.SequencedHashMap.remove(Sequenc
 edHashMap.java:460)
 at org.apache.commons.collections.LRUMap.get(LRUMap.java:93)
 at 
 org.apache.commons.dbcp.datasources.SharedPoolDataSource.getUs
 erPassKey(SharedPoolDataSource.java:176)
 at 
 org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPo
 oledConnectionAndInfo(SharedPoolDataSource.java:165)
 ... 14 more
 
 
 
 Restarting my webserver everything is working fine again. 
 Can't torque re-establish a valid connection to the database 
 by it self ?
 
 I have an heavy activity on my MSSql database, sometime I get 
 the following error message: Caused by: 
 java.sql.SQLException: I/O Error: Connection reset
 at 
 net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:797)
 at 
 net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStateme
 nt.java:332)
 at 
 net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStat
 ement.java:723)
 at 
 net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStat
 ement.java:652)
 at 
 org.apache.torque.util.BasePeer.executeStatement(BasePeer.java:1294)
 ... 6 more
 
 Does the error Connection reset is telling me I'm losting 
 one connection from the pool and after losing all connection 
 I get Could not retrieve connection info from pool ? If so, 
 do I have to create a new connection and set it on the pool ?
 
 
 Thank you,
 
 Eduardo.
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



AW: Could not retrieve connection info from pool

2007-05-02 Thread Thoralf Rickert
 But if so, shoudn't I see openned connection (socket) to the 
 database server 
 ?

Hmm, I'm not sure how the commons-pool is using the connection. In my opinion: 
yes there should be a lot of open connections. But I'm not sure about this. You 
can test this by increasing the number of max allowed connections and verify if 
they are all used frequently (I know that you can get some statistics 
informations in MySQL with SHOW xyz...).


 I do have many transactions. It is an heavy application. 
 Sometimes work 
 fine for
 one or two days and then crash (stop working), both Mysql 
 and MSSQL, 
 almost
 simultaneously.
 
 The Mysql server has much less connection (transaction) than 
 MSSql, but when 
 I got the
 Could not retrieve connection info from pool both of them 
 stop working.

That's strange. I thought that the pools are independent. But your explanation 
says my that they aren't. Maybe you're right and there are some network 
problems too.


 Not all Could not retrieve connection info from pool stops 
 my application, 
 sometimes
 it continue to run just after a get that message.
 
 My guess it some network problem occurred and the container 
 could not handle re-open of the connections. Even though 
 I've set the validationQuery.
 
 Thank you.
 
 Eduardo.
 
 - Original Message - 
 From: Thoralf Rickert [EMAIL PROTECTED]
 To: Apache Torque Users List torque-user@db.apache.org
 Sent: Wednesday, May 02, 2007 8:22 AM
 Subject: AW: Could not retrieve connection info from pool
 
 
 Hi!
 
 Is it possible, that your application uses many transactions? 
 If you forget 
 to close this connections - the pool is running out of 
 connections from time 
 to time. Maybe there is just one unclosed transaction 
 somewhere in your 
 application. If you have a lot of traffic on your site you 
 can increase the 
 number of max connections...but I'm sure there is missing commit() or 
 safeRollback().
 
 bye
 Thoralf
 
  -Ursprüngliche Nachricht-
  Von: Eduardo Kinto [mailto:[EMAIL PROTECTED]
  Gesendet: Mittwoch, 2. Mai 2007 13:09
  An: torque-user@db.apache.org
  Betreff: Could not retrieve connection info from pool
 
 
  Hello,
 
  I'm using Torque to connect to my MSSql and MySQL Server database.
 
  Everything is working fine, just one problem, some times Database 
  connection fail and don't come back (both, mysql and
  mssql) by it self and I have to restart my webserver (where it is 
  running my application).
 
  Running the command netstat, I can't see any connnection to 
 database 
  server.
 
  I'm using:
  - torque-3.2.jar
  - apache tomcat 5.5.12
  - java jdk 1.5.0_06
  - RedHat Linux Enterprise 4
 
  And the folowing torque setup for mysql:
 
  torque.dsfactory.APP.factory = 
  org.apache.torque.dsfactory.SharedPoolDataSourceFactory
  torque.dsfactory.APP.connection.driver = com.mysql.jdbc.Driver 
  torque.dsfactory.APP.connection.url = 
  jdbc:mysql://IP:PORT/APP?autoReconnect=true
  torque.dsfactory.APP.connection.user = yyy 
  torque.dsfactory.APP.connection.password = xxx 
  torque.dsfactory.APP.pool.defaultTransactionIsolation=1
  torque.dsfactory.APP.pool.maxWait=60
  torque.dsfactory.APP.pool.maxActive=32
  torque.dsfactory.APP.pool.maxIdle=32
  torque.dsfactory.APP.pool.testOnBorrow=true
  torque.dsfactory.APP.pool.validationQuery=SELECT 1
 
  And for MSSqlServer:
  torque.dsfactory.APP2.factory = 
  org.apache.torque.dsfactory.SharedPoolDataSourceFactory
  torque.dsfactory.APP2.connection.driver = 
  net.sourceforge.jtds.jdbc.Driver 
 torque.dsfactory.APP2.connection.url 
  = jdbc:jtds:sqlserver://IP:1433/DATABASE
  .. similary to mysql ...
 
  The ERROR message:
  org.apache.torque.TorqueException:
  org.apache.commons.dbcp.SQLNestedException: Could not retrieve 
  connection info from pool
  at 
  org.apache.torque.TorqueInstance.getConnection(TorqueInstance.
  java:825)
  at org.apache.torque.Torque.getConnection(Torque.java:272)
  at
  org.apache.torque.util.BasePeer.doPSSelect(BasePeer.java:1478)
  ...
  Caused by: org.apache.commons.dbcp.SQLNestedException: Could not 
  retrieve connection info from pool
  at 
  org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPo
  oledConnectionAndInfo(SharedPoolDataSource.java:169)
  at 
  org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getC
  onnection(InstanceKeyDataSource.java:631)
  at 
  org.apache.commons.dbcp.datasources.InstanceKeyDataSource.getC
  onnection(InstanceKeyDataSource.java:615)
  at 
  org.apache.torque.TorqueInstance.getConnection(TorqueInstance.
  java:821)
  ... 11 more
  Caused by: java.lang.NullPointerException
  at 
  org.apache.commons.collections.SequencedHashMap.removeEntry(Se
  quencedHashMap.java:215)
  at 
  org.apache.commons.collections.SequencedHashMap.removeImpl(Seq
  uencedHashMap.java:473)
  at 
  org.apache.commons.collections.SequencedHashMap.remove(Sequenc
  edHashMap.java:460