Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackOverflowError overriding Array.each since 1.7.5 #1265

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

Comments

Projects
None yet
3 participants
@carlossg
Copy link

commented Nov 25, 2013

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 added a commit to maestrodev/fog that referenced this issue Nov 25, 2013

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
@dmarcotte

This comment has been minimized.

Copy link
Contributor

commented Nov 25, 2013

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 added a commit to maestrodev/fog that referenced this issue Nov 25, 2013

dmarcotte added a commit to dmarcotte/jruby that referenced this issue Nov 26, 2013

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.

dmarcotte added a commit to dmarcotte/jruby that referenced this issue Nov 26, 2013

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.

This was referenced Nov 26, 2013

@headius

This comment has been minimized.

Copy link
Member

commented Nov 26, 2013

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
You can’t perform that action at this time.