This project is archived and is in readonly mode.

#1171 ✓committed
Aliaksey Kandratsenka

[PATCH] call clear_active_connections! in :after_dispatch to give pooled connections back

Reported by Aliaksey Kandratsenka | October 4th, 2008 @ 03:38 PM | in 2.x

Current rails does not return connections back to pool. I believe that people haven't run into this because of 2 things: persistent connections (which means that all requests are handled by one thread) and/or usage of servers which either process all requests with one thread or use thread pool.

Note that integration tests use dispatcher but doesn't want to rollback connection in the middle of the test. They don't want to return connection back to pool. So it's handled specially by dedicated flag on dispatcher.

Comments and changes to this ticket

  • Repository

    Repository October 4th, 2008 @ 04:49 PM

    • State changed from “new” to “committed”
    • Tag changed from activerecord, patch to actionpack, activerecord, patch

    (from [6080b73b1cf6c9ff969b81751a1e5d26d7633a32]) call clear_active_connections! in :after_dispatch to give pooled connections back

    This fixes connection pool exhaustion for web servers which create new thread per connection (e.g. Webrick).

    integration.rb changes are required to keep test transaction active for several requests.

    Signed-off-by: Michael Koziarski [#1171 state:committed]

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=""></a>

People watching this ticket


Referenced by