could not acquire application permit within 10.0 seconds

1,010 views
Skip to first unread message

Matt Parlane

unread,
Sep 18, 2012, 1:01:26 AM9/18/12
to rails-t...@googlegroups.com
Hi all...

I'm having some trouble with my (non-Rails) Rack app. It seems to be trucking along just fine, then it starts spewing stack traces. The error is this:

org.jruby.rack.AcquireTimeoutException: could not acquire application permit within 10.0 seconds

I haven't set any config variables at all so my understanding is that it should be threadsafe and have min/max runtimes set to 1. Any ideas on how to solve this?

Thanks,

Matt

kares

unread,
Sep 19, 2012, 2:05:21 AM9/19/12
to rails-t...@googlegroups.com

 Hi Matt, the issue is you're not running in thread-safe mode.

Your understanding is right - if you've used "plain" JRuby-Rack (e.g. with Warbler) it would have worked.
The JRuby-Rack default due backward compatibility is thread-safe for Rack and pooling for Rails applications.
With Trinidad we assume 1:5 pooling by default and there's no special handling to change that for Rack apps.
Thus it's behaving the same no-matter what type of application - I'm about to release a new version but I think I'll leave this as is.
Although we should mention pooling is default for all in the README (this will most likely change with Rails 4.0 adoption) ...

Rack pooling was not-supported previously (only Rails) with JRuby-Rack (<= 1.1.7) thus even if min:max runtimes were set to 1:5 it did not pool.

You can check with your logs what's happening - now they should contain a line :
using 1:5 runtime pool with acquire timeout of 5.0 seconds

Try running with --threadsafe option or set jruby_min_runtimes == jruby+max_runtime == 1 in the config and you should instead see :
using a shared (threadsafe!) runtime

For the record if someone gets here with the same error using pooling - you should increase your application pool size (jruby_max_runtimes).
Also it's desirable to boot as many runtimes as possible during startup thus we recommend set jruby_min_runtimes high (close to max) as well.
The runtime acquire timeout migth be decreased as well (JRuby-Rack's default timeout of 10 seconds seems still too much but was actually 30 previously).

K.

Matt Parlane

unread,
Sep 19, 2012, 3:33:34 AM9/19/12
to rails-t...@googlegroups.com
On Wednesday, September 19, 2012 6:05:21 PM UTC+12, kares wrote:

 Hi Matt, the issue is you're not running in thread-safe mode.

Your understanding is right - if you've used "plain" JRuby-Rack (e.g. with Warbler) it would have worked.

Hi Karol, thanks for the reply.


How am I not using "plain" jruby/rack? Does the fact that I'm using Trinidad mean I'm no longer using "plain" jruby/rack?

I'll try it with --threadsafe and report back soon. Also, you're dead right, those "using 1:5 runtime pool" lines were in the logs, I just didn't notice them.

Cheers,

Matt

Matt Parlane

unread,
Sep 19, 2012, 6:46:57 PM9/19/12
to rails-t...@googlegroups.com
Just reporting back... It's been running for about 12 hours with --threadsafe and no problems so far. Thanks for the help!

Matt
Reply all
Reply to author
Forward
0 new messages