# Re: RE: Rack Error

**URL:** <https://www.ruby-forum.com/t/re-re-rack-error/156002>\
**Category:** JRuby\
**Created:** [December 19, 2008, 4:55am UTC](https://www.ruby-forum.com/t/re-re-rack-error/156002 "2008-12-19T04:55:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_McGaffigan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d26b3c/32.png) [@Jay\_McGaffigan](https://www.ruby-forum.com/u/Jay_McGaffigan)\
**Post date:** [December 19, 2008, 4:55am UTC](https://www.ruby-forum.com/t/re-re-rack-error/156002/1 "2008-12-19T04:55:26Z")

</div>

Going to Rails 2.2 may have it's own issues though.  
  
Just today we had to back rev to 2.1 for our first "beta" sight as we are getting a pariticular multithreaded problem.&nbsp; (we are getting the body of our request set to nil underneath us).  
  
I'm trying to characterize it... But it really only seems to happen under heavy load.&nbsp; If you have a slow running job.&nbsp; 2.2 works pretty well.&nbsp; I'd recommend it.&nbsp; The memory improvement is compelling.  
  
as well as the performance improvements.  
  
  
Dec 18, 2008 12:36:40 PM, removed\_email\_address@domain.invalid wrote:

> How about:  
>   
> jthread = java.lang.Thread.new do puts "Running in a Java thread" end  
> jthread.start  
>   
> Come to think of it, why not just use the Ruby thread? Thread.new?  
>   
> Also, it sounds like if your conjecture is right, then the problem is not with  
> JRuby, but rather the blocking architecture of your app; Your only solution  
> would be to start up at least as many runtime as your expected peak  
> concurrency. If so, you should really upgrade to Rails 2.2, since that gives  
> some big memory saving.  
>   
> Of course, this is assuming that your problem is with request blocking, and  
> not some kind of JRuby leak. Are you able to tell what the heap size is, so as  
> to figure out whether it is runtime concurrency exhaustion or memory  
> exhaustion?   
>   
> Peter  
>   
> From: AD [mailto:removed\_email\_address@domain.invalid]   
> Sent: Thursday, December 18, 2008 11:13 AM  
> To: removed\_email\_address@domain.invalid  
> Subject: Re: [jruby-user] Rack Error  
>   
> So I think what \*could\* be causing this is we need to make a remote soap calls  
> (using soap/wsdldriver and soap/header/SimpleHandler) and it can take up to  
> 30seconds to a minute to process (they dont support Async and we are in the  
> process of moving this to a JMS queue)  
>   
> Is there an easy way to wrap this in a Java thread (aside from a rails 2.2  
> upgrade) ? &nbsp;I think what could be happening is 8 simultaneous calls are being  
> made tying up all Jruby runtimes. &nbsp;What I dont get is why the whole app server  
> dies after this happens.  
>   
> We have 8 runtimes available.  
>   
> Adam  
> On Thu, Dec 18, 2008 at 11:24 AM, Charles Oliver N.  
>   
> Ok, now we can start looking at your problem in earnest :)  
>   
> Can you describe your configuration? How many runtimes? How heavily are they  
> hit? The error below I believe means that there's no runtimes available in the  
> pool, and so the request can't be handled. What do you have to do to cause  
> this error?  
>   
> AD wrote:  
> Sorry guys, same error again on 1.1.6 with rack 0.9.3  
>   
> SEVERE: Exception caught  
> org.jruby.rack.RackInitializationException: timeout: all listeners busy  
> &nbsp; &nbsp; &nbsp; &nbsp;at  
> org.jruby.rack.PoolingRackApplicationFactory.getApplication(PoolingRackApplica  
> tionFactory.java:87)  
> &nbsp; &nbsp; &nbsp; &nbsp;at  
> org.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:31)  
> &nbsp; &nbsp; &nbsp; &nbsp;at org.jruby.rack.RackFilter.doFilter(RackFilter.java:51)  
> &nbsp; &nbsp; &nbsp; &nbsp;at  
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFi  
> lterChain.java:215)  
> &nbsp; &nbsp; &nbsp; &nbsp;at  
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChai  
> n.java:188)  
> &nbsp; &nbsp; &nbsp; &nbsp;at  
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java  
> :213)  
> &nbsp; &nbsp; &nbsp; &nbsp;at  
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java  
> :172)  
> &nbsp; &nbsp; &nbsp; &nbsp;at  
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)  
> &nbsp; &nbsp; &nbsp; &nbsp;at  
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)  
>   
> Adam  
>   
>   
> On Thu, Dec 18, 2008 at 9:01 AM, AD   
>   
>   
> &nbsp; &nbsp;Thanks Charlie, I couldnt agree more here. &nbsp;A lot of conversation on  
> &nbsp; &nbsp;this group about different GC algorithms, PermGen, Newsize, etc it  
> &nbsp; &nbsp;would be good to get a dedicated section on the Wiki. &nbsp;I also think  
> &nbsp; &nbsp;this will soon change with Rails 2.2 and multi-threading since we  
> &nbsp; &nbsp;wont need as many runtimes in the heap so maybe now is a good time  
> &nbsp; &nbsp;as any to address it.  
>   
> &nbsp; &nbsp;On your first comment , are you saying an Xmn of 128M is way too small ?  
>   
> &nbsp; &nbsp;Thx  
> &nbsp; &nbsp;Adam  
>   
>   
> &nbsp; &nbsp;On Thu, Dec 18, 2008 at 1:10 AM, Charles Oliver N.  
> &nbsp; &nbsp;  
>   
> &nbsp; &nbsp; &nbsp; &nbsp;Yes, that's another area we really need more tuning  
> &nbsp; &nbsp; &nbsp; &nbsp;help...perhaps we should start or update a page on the wiki and  
> &nbsp; &nbsp; &nbsp; &nbsp;make it boldface and flashing?  
>   
> &nbsp; &nbsp; &nbsp; &nbsp;-Xmn is an important one because Ruby is so hard on the heap.  
> &nbsp; &nbsp; &nbsp; &nbsp;There's soooo many objects being created and collected, it needs  
> &nbsp; &nbsp; &nbsp; &nbsp;a pretty good sized new generation for most nontrivial apps.  
>   
> &nbsp; &nbsp; &nbsp; &nbsp;You should also get comfortable using jconsole. If you run JRuby  
> &nbsp; &nbsp; &nbsp; &nbsp;in an app server or using the --manage flag, you can connect to  
> &nbsp; &nbsp; &nbsp; &nbsp;it with jconsole and monitor heap utilization (various  
> &nbsp; &nbsp; &nbsp; &nbsp;generations) GC time, and a whole host of JRuby statistics.  
>   
> &nbsp; &nbsp; &nbsp; &nbsp;I think this may be one of the last frontiers for getting JRuby  
> &nbsp; &nbsp; &nbsp; &nbsp;to really peak performance (other than additional hackery and  
> &nbsp; &nbsp; &nbsp; &nbsp;optimization, which we continue to do), since it's obvious that  
> &nbsp; &nbsp; &nbsp; &nbsp;the default settings for the JVM are tuned to \*Java\*  
> &nbsp; &nbsp; &nbsp; &nbsp;applications. We need to start exploring the hundreds of options  
> &nbsp; &nbsp; &nbsp; &nbsp;(and perhaps dozens that are directly relevant) to know the  
> &nbsp; &nbsp; &nbsp; &nbsp;right settings for \*Ruby\* applications, and make sure others  
> &nbsp; &nbsp; &nbsp; &nbsp;know about them.  
>   
> &nbsp; &nbsp; &nbsp; &nbsp;- Charlie  
>   
> &nbsp; &nbsp; &nbsp; &nbsp;AD wrote:  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Fair assesment. &nbsp;We are rolling out 1.1.6 to dev/qa tomorrow  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;will see how things look. &nbsp;I can say this, from a memory  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;standpoint simply adding Xmn=128M to our JAVA\_OPTS has  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dropped our average heap size from 3gb to about 1.7Gb .  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Will post my results later this week.  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;adam  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;On Wed, Dec 17, 2008 at 9:35 PM, Charles Oliver N.  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AD wrote:  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Is there a way to determine the size of a runtime ?  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; We keep  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hitting OutofMem errors and just trying to figure out  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;to tune  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this thing. &nbsp;We are going to force set the New Size  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;via -Xmn to  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; something like 128M to force more frequent garbage  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;collection,  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; will see if that helps.  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; we shouldnt really be hitting OutOfMem errors so easily ,  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; especially with a 4Gb heap on an 8Gb mem box. &nbsp;We  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;also turned on  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; thread.pooling to see how that behaves.  
>   
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; OutOfMemoryErrors come in many flavors; oddly enough, you  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;can also  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get OutOfMemoryError when the JVM can't spin up any more  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;threads,  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; which was the issue Peter Chan discovered. So try out  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1.1.6 and then  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get back to us if you still see issues.  
>   
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; - Charlie  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  
> ---------------------------------------------------------------------  
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; To unsubscribe from this list, please visit:  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; http://xircles.codehaus.org/manage\_email  
>   
>   
>   
>   
>   
> &nbsp; &nbsp; &nbsp; &nbsp;---------------------------------------------------------------------  
> &nbsp; &nbsp; &nbsp; &nbsp;To unsubscribe from this list, please visit:  
>   
> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;http://xircles.codehaus.org/manage\_email  
>   
>   
>   
>   
>   
> ---------------------------------------------------------------------  
> To unsubscribe from this list, please visit:  
>   
> &nbsp; http://xircles.codehaus.org/manage\_email  
>   
>   
>   
>   
> ---------------------------------------------------------------------  
> To unsubscribe from this list, please visit:  
>   
> http://xircles.codehaus.org/manage\_email

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email
```

---

<div class="post-metadata">

**Author:** ![Jay\_McGaffigan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d26b3c/32.png) [@Jay\_McGaffigan](https://www.ruby-forum.com/u/Jay_McGaffigan)\
**Post date:** [December 19, 2008, 5:27am UTC](https://www.ruby-forum.com/t/re-re-rack-error/156002/2 "2008-12-19T05:27:38Z")

</div>

We need to explore your problem in more detail, and probably enlist the  
Rails guys. They’ll want to fix whatever it is…

Jay McGaffigan wrote:

> as well as the performance improvements.
> 
> ```
> blocking, and
> Subject: Re: [jruby-user] Rack Error
> rails 2.2
> 
> AD wrote:
> at
> :172)
> 
> Thx
> -Xmn is an important one because Ruby is so hard on the heap.
> optimization, which we continue to do), since it's obvious that
> Fair assesment. We are rolling out 1.1.6 to dev/qa tomorrow
>            
> something like 128M to force more frequent garbage
> OutOfMemoryErrors come in many flavors; oddly enough, you
>                        
> ---------------------------------------------------------------------
> 
> ```
> 
> --------------------------------------------------------------------- To  
> unsubscribe from this list, please visit:  
> [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Jay\_McGaffigan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d26b3c/32.png) [@Jay\_McGaffigan](https://www.ruby-forum.com/u/Jay_McGaffigan)\
**Post date:** [December 19, 2008, 2:17pm UTC](https://www.ruby-forum.com/t/re-re-rack-error/156002/3 "2008-12-19T14:17:47Z")

</div>

Yes I agree! 🙂

I am working to try and narrow it down.

I’ve posted to the rails email list but not gotten any real response.  
I’ve asked at the chat room to the same effect. So I figured I’d wait a  
couple of days before reposting and hopefully I Can get a better set of  
information to share.

Jay

---

<div class="post-metadata">

**Author:** ![Jay\_McGaffigan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d26b3c/32.png) [@Jay\_McGaffigan](https://www.ruby-forum.com/u/Jay_McGaffigan)\
**Post date:** [December 19, 2008, 4:46pm UTC](https://www.ruby-forum.com/t/re-re-rack-error/156002/4 "2008-12-19T16:46:12Z")

</div>

Ping nzkoz on IRC or Twitter once you have something narrowed down. I  
know he’ll want to get it repaired.

Jay McGaffigan wrote:

> Sent: Thursday, December 18, 2008 11:27 PM
> 
> > are getting a pariticular multithreaded problem. (we are getting the
> > 
> > ```
> > solution
> > exhaustion?
> > (using soap/wsdldriver and soap/header/SimpleHandler) and it can
> > app server
> > are they
> > org.jruby.rack.RackInitializationException: timeout: all listeners busy
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChai
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
> > this will soon change with Rails 2.2 and multi-threading since we
> > On Thu, Dec 18, 2008 at 1:10 AM, Charles Oliver N.
> > You should also get comfortable using jconsole. If you run JRuby
> > right settings for *Ruby* applications, and make sure others
> > 
> > we shouldnt really be hitting OutOfMem errors so
> > which was the issue Peter Chan discovered. So try out
> > http://xircles.codehaus.org/manage_email
> > 
> > ```
> 
> * * *
> 
> To unsubscribe from this list, please visit:
> 
> ```
> http://xircles.codehaus.org/manage_email
> 
> ```

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```
