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.

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

#1171

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.

Reported by Aliaksey Kandratsenka · October 4th, 2008 @ 03:38 PM

State: committed
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Repository
    Repository
    • 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 michael@koziarski.com [#1171 [PATCH] call clear_active_connections! in :after_dispatch to give pooled conn... state:committed] http://github.com/rails/rails/co...

    October 4th, 2008 @ 04:49 PM