Rails 3.1 Thread Damage

Or something like that. I have updated several applications from Rails 3.0 to Rails 3.1. They run on Thin with multithreading enabled, all configured with thread safety !. Worked fine in Rails 3.0. But in 3.1, after several requests, everything starts to slow down. After several requests, the pages freeze for N seconds (where N is my db timeout) and I get this error:

ActiveRecord::ConnectionTimeoutError (could not obtain a database connection within 5 seconds. The max pool size is currently 5; consider increasing it.): 

These default values โ€‹โ€‹of 5 and 5 were found in the past and should still be in order. In addition, their increase does not eliminate the problem, although it takes a little longer to manifest it. I must emphasize that at that time I was the only one who turned to applications. When I drop Thin to single-threaded mode, everything works as expected.

This happens with MySQL, SQLite, Ruby 1.8.7 and Ruby 1.9.2. Thin does not change. The only variable I can find is updating to Rails 3.1. Is there anything I can do, or is it a regression in Rails?

+4
source share
1 answer

This seems like a mistake. There are corrections and pull the request for it. Hopefully Rails will unite it. Until then, multi-threaded Rails applications will not work with Thin.

https://github.com/rails/rails/pull/1670

+1
source

All Articles