Re: [jruby-user] Concurrency issues with JRuby on Rails

Bruce Adams <[email protected]> Mon, 19 Jan 2015 16:43:40 -0500
Newsgroups gmane.comp.lang.jruby.user
Message-ID <1421703820.3059930.215963345.5CDC3D25@webmail.messagingengine.com>
It sounds like the twenty database connection you are allowing are all
in use for more than 15 seconds.

Is your Rails server under much load? (Are there many, concurrent
requests? Are a bunch of those requests taking a long time (several
seconds) to complete?)

Is there a chance that your application is leaking database connections?
That is, might their be code paths where a connection is taken from the
database connection pool, but never returned to the pool?

Can you increase the size of your database connection pool?

- Bruce

P.S. For what it's worth, I recommend a low checkout_timeout,
     specifically one second. I don't what a user request waiting around
     for resources. Fifteen seconds is a very long time for a user to
     wait for a web request. I'd rather give the user (and my own error
     logs) a message quickly when I run out of resources. With an error
     message, I get earlier notice that something isn't quite right.

On Mon, Jan 19, 2015, at 04:28 PM, Chason Choate wrote:
> Hello there,
>
> I'm running into some concurrency issues and need some help. I'm
> currently using JRuby 1.7.12 and Rails 4.1.1. Every now and then i'm
> getting this error:
>
> ActiveRecord::ConnectionTimeoutError (could not obtain a database
> connection within 15.000 seconds (waited 15.001 seconds)):
> vendor/bundle/jruby/1.9/gems/activerecord-4.1.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in
> `wait_poll'
>
> Our database pool is set to 20 and a checkout_timeout of 15.
>
> Has anyone seen this issue before?
> --
> Thanks, Chason Choate