Stale connections using ActiveRecord jdbcmysql adapter

I have background threads that share a ActiveRecord connection, when
they go stale (and mysqld closes the connection) the first connections
fail. I’m trying a verify! on the connection without luck.

David

It appears to be working better with my upgrade to 1.0.2. Previously, I
was able to recreate it by:

Start up the threads and have them do some work
Kill their connections in mysql
Queue up more work, first job in each thread fails

Now, with a verify! at the beginning of each job and 1.0.2, this no
longer appears to be happening. I was previously running 0.9.7, I ran a
diff among 0.9-stable and master but didn’t see anything that was
obviously causing the problem.

David

Actually I saw this error again. Is there something I need to do
especially for doing concurrent access in ActiveRecord 2.3.5?
(:reconnect in options? - I know allow_concurrency has been deprecated)

It appears to solve itself after the first database request for each
thread though, but the first one does fail.

David

AR-JDBC does have reconnect logic, but I’m curious to know why it’s
failing. You can see it here, in the withConnectionAndRetry and
isConnectionBroken methods. Any chance you can run with ‘jruby -d’
(debug flag) and get more information?

http://github.com/nicksieger/activerecord-jdbc-adapter/blob/master/src/java/arjdbc/jdbc/RubyJdbcConnection.java#L1143
http://github.com/nicksieger/activerecord-jdbc-adapter/blob/master/src/java/arjdbc/jdbc/RubyJdbcConnection.java#L793

/Nick

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs