Reconnects in connection pool
-----------------------------

                 Key: JRUBY-1547
                 URL: http://jira.codehaus.org/browse/JRUBY-1547
             Project: JRuby
          Issue Type: Bug
          Components: ActiveRecord-JDBC
            Reporter: Jorgen Austvik


Hi,

When we are running JRuby in a Glassfish connection pool, and the Glassfish 
temporarily loose connection to the database
the JRuby software fail to re-establish a connection to the database when it 
comes up, while Java programs works fine.
For JRuby (using ActiveRecord-JDBC) we have to restart the GlassFish to get 
thing going again.

This is what I suspect is the problem, I might be wrong:

In JdbcAdapterInternalService we have lots of this pattern:

while (true) {
   try {
    // do something
   } catch(SQLException e) {
      if(c.isClosed()) {
         recv = 
recv.callMethod(recv.getRuntime().getCurrentContext(),"reconnect!");
         if(!((Connection)recv.dataGetStruct()).isClosed()) {
            continue;
         }
      }
      throw e;
   }
}

In a connection pool this will not work, because the connection pool is not 
notified (with a SQLException) that it has
to reconnect.

I think we should at least have a max count on how many times the loop is 
retried , and if we go over the max count
- throw e without trying to reconnect. It might be OK to just throw out the 
reconnection all together.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to