Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Active Record connection pool Rails 3.0.6

#6714

The database connection is not released after the background task finishes, I am seeing this issue after the upgrade to Rails 3.0.6 from 3.0.5. Is anyone else facing this issue with Rails 3.0.6?.

 prefix/tools_64/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:202:in `block (2 levels) in checkout': could not obtain a database connection within 5 seconds.  The max pool size is currently 5; consider increasing it. (ActiveRecord::ConnectionTimeoutError)
    from prefix/tools_64/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:187:in `loop'
    from prefix/tools_64/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:187:in `block in checkout'
    from prefix/tools_64/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
    from prefix/tools_64/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in `checkout'
    from prefix/tools_64/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:94:in `connection'
    from prefix/tools_64/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:317:in `retrieve_connection'
    from prefix/tools_64/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:97:in `retrieve_connection'
    from prefix/tools_64/lib/ruby/gems/1.9.1/gems/activerecord-3.0.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection'

Environment Ruby 1.9.2-p180 and Rails 3.0.6 on CentOS 4.5 x86_64

Thank you
Chaitanya

Reported by chaitanyav · April 18th, 2011 @ 06:41 PM

State: new
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. chaitanyav
    chaitanyav

    There was a issue filed before #5736 connections not released in rails 3, I think the issue is still not resolved,

    Loading development environment (Rails 3.0.6)
    >> Thread.list
    => [#<Thread:0x00000000551e28 run>]
    >> 5.times do
    ?>     Thread.new do
    ?>       ActiveRecord::Base.connection_pool.checkout
    >>     end.join
    >>   end
    => 5
    >> Thread.list
    => [#<Thread:0x00000000551e28 run>]
    >> ActiveRecord::Base.connection_pool.checkout
    ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5 seconds.  The max pool size is currently 5; consider increasing it.
    

    I also manually tried

    >> ActiveRecord::Base.connection_pool.clear_stale_cached_connections!
    => []
    >> ActiveRecord::Base.connection_pool.checkout
    ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5 seconds.  The max pool size is currently 5; consider increasing it.
    

    Thank you
    Chaitanya

    April 18th, 2011 @ 07:32 PM