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
Closed

StackOverflowError overriding Array.each since 1.7.5 #1265

carlossg opened this issue Nov 25, 2013 · 2 comments
Milestone

Comments

@carlossg
Copy link

@carlossg carlossg 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 pushed a commit to maestrodev/fog that referenced this issue Nov 25, 2013
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
Copy link
Contributor

@dmarcotte dmarcotte 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 pushed 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 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 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
Copy link
Member

@headius headius 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants