Bugs item #15236, was opened at 2007-10-31 11:09
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=15236&group_id=2014

Category: AR-JDBC
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Nobody (None)
Assigned to: Nobody (None)
Summary: Reconnects in connection pool

Initial Comment:
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.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=15236&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel

Reply via email to