StackOverflowError overriding Array.each since 1.7.5 #1265

Closed
carlossg opened this Issue Nov 25, 2013 · 2 comments

3 participants

@carlossg

Simplified code taken from fog gem to reproduce the issue. Works on jruby 1.7.4, but not since then

class Collection < Array
  def each
    super
  end
end

Collection.new.all? {|x| true}
puts "OK"
$ rvm jruby-1.7.8 do ruby test.rb
Error: Your application used more stack memory than the safety cap of 2048K.
Specify -J-Xss####k to increase it (#### = cap size in KB).
Specify -w for full StackOverflowError stack trace

$ rvm jruby-1.7.5 do ruby test.rb
Error: Your application used more stack memory than the safety cap of 2048K.
Specify -J-Xss####k to increase it (#### = cap size in KB).
Specify -w for full StackOverflowError stack trace

$ rvm jruby-1.7.4 do ruby test.rb
OK

a section of the stacktrace

at org.jruby.RubyArray.all_p(RubyArray.java:4009)
at org.jruby.RubyEnumerable.all_pCommon(RubyEnumerable.java:1397)
at org.jruby.RubyArray.all_p(RubyArray.java:4009)
at org.jruby.RubyEnumerable.all_pCommon(RubyEnumerable.java:1397)
at org.jruby.RubyArray.all_p(RubyArray.java:4009)
at org.jruby.RubyEnumerable.all_pCommon(RubyEnumerable.java:1397)
at org.jruby.RubyArray.all_p(RubyArray.java:4009)

java "1.7.0_45" OS X Mavericks

@carlossg carlossg added a commit to maestrodev/fog that referenced this issue Nov 25, 2013
@carlossg carlossg all? not working in JRuby 1.7.5+. Configure Travis
That's the reason the travis build is failing on jruby, the override of `each` in Collection stopped working after 1.7.4
jruby/jruby#1265
ecd558b
@dmarcotte

Thanks for the compact repro @carlossg. Made it easy to bisect this down to 91c11f0 as the culprit.

Will have a look and send a fix along soon...

@carlossg carlossg added a commit to maestrodev/fog that referenced this issue Nov 25, 2013
@carlossg carlossg Disable specific tests that don't pass on jruby 1.7.5+ 6c386fc
@dmarcotte dmarcotte added a commit to dmarcotte/jruby that referenced this issue Nov 26, 2013
@dmarcotte dmarcotte Fix arrays with overridden each
Fix a stack overflow in Array#all (jruby#1265)
and restore the correct behavior for Array#any (the needed isBuiltn
check was incorrectly removed in jruby#1234)

Also add a spec to ensure this remains stable going forward.
d014156
@dmarcotte dmarcotte added a commit to dmarcotte/jruby that referenced this issue Nov 26, 2013
@dmarcotte dmarcotte Fix arrays with overridden each
Fix a stack overflow in Array#all (jruby#1265)
and restore the correct behavior for Array#any (the needed isBuiltn
check was incorrectly removed in jruby#1234)

Also add a spec to ensure this remains stable going forward.
ea9deff
This was referenced Nov 26, 2013
@headius
JRuby Team member

Fixed by #1271.

@headius headius closed this Nov 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment