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

Projects
None yet
3 participants
@gdeoliveira

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

This comment has been minimized.

Show comment
Hide comment
@headius

headius Nov 29, 2016

Member

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

Member

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