Forum: JRuby stack level too deep error with Glassfish

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joseph A. (Guest)
on 2009-05-15 08:16
(Received via mailing list)
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:in `index'
  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

|#]

[#|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
|#]
Jacob K. (Guest)
on 2009-05-15 21:06
(Received via mailing list)
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
Joseph A. (Guest)
on 2009-05-15 21:41
(Received via mailing list)
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:in `get'
from /Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:611:in `each'
from /Users/jjathman/jruby/lib/ruby/1.8/getoptlong.rb:610:in `loop'
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:in
`parse'
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$
Jacob K. (Guest)
on 2009-05-15 21:51
(Received via mailing list)
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
Joseph A. (Guest)
on 2009-05-16 03:07
(Received via mailing list)
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
Joseph A. (Guest)
on 2009-05-16 05:51
(Received via mailing list)
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:
http://github.com/maccman/juggernaut_plugin/tree/master
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
Charles Oliver N. (Guest)
on 2009-05-21 22:43
(Received via mailing list)
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:
> 5) 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
>             <removed_email_address@domain.invalid 
<mailto:removed_email_address@domain.invalid>
>                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
Joseph A. (Guest)
on 2009-05-21 23:32
(Received via mailing list)
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.
http://github.com/maccman/juggernaut_plugin/blob/5...

(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. <
Charles Oliver N. (Guest)
on 2009-05-22 01:15
(Received via mailing list)
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/
>         <removed_email_address@domain.invalid 
<mailto:removed_email_address@domain.invalid>
>            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
This topic is locked and can not be replied to.