开发者

Jruby Activerecord is giving me stale connections

I have a Jruby app that spins up several background Java threads that share an ActiveRecord (2.3.开发者_开发百科5) connection. If they sleep for some time and then try to do something database related, the first queries never execute. I believe this is because the connections are stale, but the code itself doesn't throw any errors.

I've tried doing a ActiveRecord::Base.connection.verify! but it still craps out. I'm using ActiveRecord jdbcmysql 0.9.7 but am now trying the newest 1.0.2 to see if that helps.


We had the exact problem, the solution is to call the line of code below at the end of the thread.

ActiveRecord::Base.clear_active_connections!
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜