Stack level too deep error with Glassfish

Anyone seen this error before? I previously had my application working
under glassfish, but I don’t know what’s going wrong now. The
application
works just fine under JRuby and Mongrel.
JRuby trunk
Glassfish gem version 0.9.3
Rails 2.3.2

[#|2009-05-14T23:12:48.690-0500|INFO|glassfish|javax.enterprise.system.core|_ThreadID=14;_ThreadName=Thread-2;|
SystemStackError (stack level too deep):
app/controllers/rail_visits_controller.rb:20:in index' app/controllers/rail_visits_controller.rb:17:inindex’
file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:82:in
serve_rails' file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:109:incall’
file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:81:in
call' file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/handler/grizzly.rb:55:incall’
:1

|#]

[#|2009-05-14T23:12:48.700-0500|INFO|glassfish|javax.enterprise.system.core|_ThreadID=14;_ThreadName=Thread-2;|/!
FAILSAFE /!\ Thu May 14 23:12:48 -0500 2009
Status: 500 Internal Server Error
stack level too deep

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:82:in
`initialize’

/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in
`call’

/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/head.rb:9:in
`call’

/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/methodoverride.rb:24:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/rewindable_input.rb:25:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/session/abstract_store.rb:122:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
`cache’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in
`cache’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
`cache’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in
`cache’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/reloader.rb:9:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/failsafe.rb:11:in
`call’

/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:106:in
`call’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:44:in
`dispatch_cgi’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:102:in
`dispatch_cgi’

/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:28:in
`dispatch’

file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:82:in
`serve_rails’

file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:109:in
`call’

file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:81:in
`call’

file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/handler/grizzly.rb:55:in
`call’
:1
|#]

Interesting… That’s not the normal error that we see around stack
sizes, but it looks like the root cause is still a stack overflow error
out of the JVM. We’ve seen the issue a few times with larger Rails apps,
since the Glassfish Gem adds another few layers to the stack and
eventually pushes it over. You can try increasing the stack size
(-JXss512k, for example) to see if that solves it, which it hopefully
will.

Joseph A. wrote:

`call’

`call’
/Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in

`cache’
/Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/failsafe.rb:11:in

`call’

file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:81:in
`call’

file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/handler/grizzly.rb:55:in
`call’
:1
|#]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I must be doing something wrong with that option.

arthman:railpro jjathman$ glassfish -JXss512k
/Users/jjathman/jruby/bin/glassfish: invalid option – J
/Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:403:in set_error': invalid option -- J (GetoptLong::InvalidOption) from /Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:580:inget’
from /Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:611:in each' from /Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:610:inloop’
from /Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:610:in each' from /Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/lib/command_line_parser.rb:89:inparse’
from
/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/bin/glassfish:55
from
/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/bin/glassfish:19:in
`load’
from /Users/jjathman/jruby/bin/glassfish:19
arthman:railpro jjathman$

I’m still getting the same error. I created a fresh app from scratch
and
that seemed to work OK so my JRuby and Glassfish installations must be
OK.
So you think this is a memory problem? Any way for me to see what is
eating up so much stack space?
Joe

Ah, since that’s a JVM option you’ll need to pass it in to JRuby, rather
than glassfish. Try “jruby -J-Xss512k -S glassfish”

Joseph A. wrote:

from /Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:610:in `each’

solves it, which it hopefully will.
    Glassfish gem version 0.9.3
     file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:82:in

     
    `call'
     /Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in
     
    `call'
     /Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:106:in
     
    `call'

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

I have localized this problem to a plugin we are using. It seems as
though
installing the Juggernaut plugin completely breaks requests under
Glassfish.
The plugin is here:

To recreate the problem:

  1. create a new rails application
  2. install juggernaut plugin
  3. update database.yml to work with jdbc
  4. start app under glassfish gem
  5. go to http://localhost:3000/
  6. try to click on the “About your application’s environment”

Clicking the link will cause the exception to be thrown. This will all
work
fine under JRuby using mongrel though. I hope this helps. We really
want
to use glassfish but this pretty much puts us dead in the water.

Joe

Vivek or Jacob: any progress on this one? That it fails only in
GlassFish means it’s hard for us to hunt it down on the JRuby side.

Joseph A. wrote:

  1. go to http://localhost:3000/

         /Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:403:in
         /Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/lib/command_line_parser.rb:89:in
         <[email protected] <mailto:[email protected]>
            layers to the stack and eventually pushes it over. You
         what's
    
         file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:109:in
    
                `call'
         /Users/jjathman/rail_projects/railpro/vendor/rails/actionpack/lib/action_controller/rewindable_input.rb:25:in
                        
                `call'
         /Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in
                        
                `dispatch'
         file:/Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/modules/grizzly-jruby.jar!/rack/handler/grizzly.rb:55:in
              http://xircles.codehaus.org/manage_email
    

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Interesting…have you filed a bug for this? If not, put this and all
other information into it.

Joseph A. wrote:

include Juggernaut::RenderExtension
Hope this helps some.

    5) go to http://localhost:3000/
    <[email protected] <mailto:[email protected]>
       On Fri, May 15, 2009 at 12:55 PM, Jacob K.
               I must be doing something wrong with that option.
               from
     /Users/jjathman/jruby/lib/ruby/gems/1.8/gems/glassfish-0.9.3-universal-java/lib/command_line_parser.rb:89:in

                  stack sizes, but it looks like the root cause is
    to see
               what's

                      `serve_rails'

                                       
                      `call'
     /Users/jjathman/rail_projects/railpro/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in
                                       
                      `call'
     /Users/jjathman/jruby/lib/ruby/gems/1.8/gems/rack-1.0.0/lib/rack/lock.rb:11:in
                                       
                      `call'
                  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

Here’s a little more of an update from our end. We found that
Juggernaut
aliases the render methods in rails and injects some of its own behavior
in
there. Since our application is mainly XML based we found that we could
live without this. By commenting out the following lines in the init.rb
file of the plugin we got around the problem.

(lines 11-21)
ActionController::Base.class_eval do
alias_method :render_without_juggernaut, :render
include Juggernaut::RenderExtension
alias_method :render, :render_with_juggernaut
end

ActionView::Base.class_eval do
alias_method :render_without_juggernaut, :render
include Juggernaut::RenderExtension
alias_method :render, :render_with_juggernaut
end

Hope this helps some.

Joe

On Thu, May 21, 2009 at 1:41 PM, Charles Oliver N. <