When triggering a call to method_missing on a Rails server running in development mode, it dies with a StackOverflowError
. This is a Rails5 on JRuby environment. We are not using multi-threading here.
The behavior can be summarized as follows:
- The class in which the StackOverflow occurs was written by ourselves. Implementing
def method_missing
and raising from there results in correct behavior (e.g.fail 'oh noes.'
will print the expected error). - Calling super(*args) in the
method_missing
implemented will result in aStackOverflowError
again. - Calling
debugger
right abovesuper
works and typingnext
reveals that the following calls are:gems/actionpack-5.0.1.rc2/lib/action_controller/metal/rescue.rb:22
request.env['action_dispatch.show_detailed_exceptions'] ||= show_detailed_exceptions?
gems/actionpack-5.0.1.rc2/lib/action_controller/metal/rescue.rb:23
rescue_with_handler(exception) || raise
- [StackOverflow]
- In the debug shell (as in point 3), any attempt to get a trace via
backtrace
orinfo stack
will result in a StackOverflow. - None of this happens when the server is started in test or production environment.
We saw that some code was removed in Rails in this commit. Indeed, putting the deleted code back in (for testing purposes only) resolves the problem.
Do you think this is a rails bug?
Possibly solved in https://github.com/rails/rails/issues/27481. Seems like a jruby bug.