Stack overflow in unresolvedSuper logic from jitted code #4272

headius opened this Issue Nov 8, 2016 · 1 comment


None yet

1 participant

headius commented Nov 8, 2016


At least JRuby and

Attempting to run tests with -Xjit.threshold=0 for hexapdf.

Expected Behavior

When running with threshold=0, the tests should still run.

Actual Behavior

Instead, we get the following stack overflow:

/Users/headius/projects/jruby/lib/ruby/gems/shared/gems/rake-11.3.0/lib/rake/task.rb:197: warning: singleton on non-persistent Java type Java::JavaLang::StackOverflowError (
rake aborted!

It appears that the calculation of what class to "super" up ends up with wrong results in the JIT. Specifically, in this case, Rake's FileUtilsExt module, which mixes in FileUtils and which is itself extended into other classes, ends up finding itself as its own superclass. I have been unable to reproduce the problem with a simple snippit; there's something different in the Rake class hierarchy that's triggering this.

To reproduce, just check out hexapdf and run jruby -Xjit.threshold=0 -S rake test.

@headius headius added a commit that closed this issue Nov 9, 2016
@headius headius Reinstate WrapperMethod for visibility changes. Fixes #4272.
This was introduced via a fix for #3869, to update impl class so
that transplanted methods would super correctly. However, this
logic - which does not want a new impl class - got caught up. The
fix here reverts to using WrapperMethod for now, until we start
managing visibilty more like MRI or come up with a better fix.
@headius headius closed this in f2f6c54 Nov 9, 2016
@headius headius added this to the JRuby milestone Nov 9, 2016
@headius headius added the regression label Nov 9, 2016
headius commented Nov 9, 2016

For the record, this was introduced in 9b4e97b. The change there caused this stack overflow because it duplicated a method, stuffed it into a child class, changed its impl class to that child, and that caused it to super into itself repeatedly. This change reverts to WrapperMethod, which only serves to hold a method plus a new visibility in our method tables, and does not pass on implementationClass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment