Or something like that. I’ve upgraded several apps from Rails 3.0 to
Rails 3.1. They have been running on Thin with the multithreaded
option enabled, are are all configured with threadsafe!. Worked great
in Rails 3.0. But in 3.1, after a few requests, pages take a few
seconds to load (though the Rails logs do not record the extra time).
After a few more requests, the pages hangs 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.)
Those default values of 5 and 5 have been fine in the past and should
still be fine. Also, increasing them does not fix the problem, though
it takes a little longer to manifest. I should stress that during
these times I have been the only one accessing the apps, and my
requests have not been “concurrent.” When I drop Thin down to single-
threaded mode, everything works correctly.
This occurs when using MySQL, SQLite, Ruby 1.8.7 and Ruby 1.9.2. Thin
is unchanged. The only variable I can find is the upgrade to Rails
3.1. Is there anything I can do, or is this a regression in Rails?