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

Class clones and duplicates raise StackOverflowError when listing their singleton class ancestors #4339

Closed
gdeoliveira opened this issue Nov 27, 2016 · 1 comment

Comments

@gdeoliveira
Copy link

@gdeoliveira gdeoliveira commented Nov 27, 2016

Environment

Running inside 9-alpine docker container.

jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 OpenJDK 64-Bit Server VM 25.111-b14 on 1.8.0_111-internal-alpine-r0-b14 +jit [linux-x86_64]
Linux dfcfcfee1b70 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 Linux

Expected Behavior (MRI 2.3.1)

Klass = Class.new
Clone = Klass.clone
Dup = Klass.dup

Clone.singleton_class.ancestors
#=> [#<Class:Clone>, #<Class:Object>, #<Class:BasicObject>, Class, Module, Object, PP::ObjectMixin, Kernel, BasicObject]

Dup.singleton_class.ancestors
#=> [#<Class:Dup>, #<Class:Object>, #<Class:BasicObject>, Class, Module, Object, PP::ObjectMixin, Kernel, BasicObject]

Actual Behavior

Klass = Class.new
Clone = Klass.clone
Dup = Klass.dup

Clone.singleton_class.ancestors
Java::JavaLang::StackOverflowError: 
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
... 992 levels...
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)

Dup.singleton_class.ancestors
Java::JavaLang::StackOverflowError: 
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
... 992 levels...
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
	from org.jruby.RubyModule.to_s(RubyModule.java:2183)
	from org.jruby.RubyBasicObject.inspect(RubyBasicObject.java:1105)
@headius
Copy link
Member

@headius headius commented Nov 29, 2016

Appears to be fixed on master. Probably same fix as #4340.

@headius headius closed this Nov 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.