This project is archived and is in readonly mode.

#6714 new
chaitanyav

Active Record connection pool Rails 3.0.6

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

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

Comments and changes to this ticket

  • chaitanyav

    chaitanyav April 18th, 2011 @ 07:32 PM

    There was a issue filed before #5736, 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

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages