quasar icon indicating copy to clipboard operation
quasar copied to clipboard

StackOverflowError with v0.7.7 and QuasarURLClassLoader

Open hollingsworthd opened this issue 9 years ago • 1 comments

I am using the Quasar URL classloader instead of the Java agent or other approaches. Suspendables scanning is done at runtime, invoking the Quasar Ant tasks. I wanted to mention my setup because it's probably fairly unique and maybe why this bug hasn't been encountered yet. Everything works fine in v0.7.6 but in v0.7.7 I get:

java.lang.RuntimeException: java.lang.StackOverflowError
	at co.paralleluniverse.fibers.instrument.QuasarURLClassLoader.defineClass(QuasarURLClassLoader.java:224)
	at co.paralleluniverse.fibers.instrument.QuasarURLClassLoader.access$200(QuasarURLClassLoader.java:41)
	at co.paralleluniverse.fibers.instrument.QuasarURLClassLoader$2.run(QuasarURLClassLoader.java:90)
	at co.paralleluniverse.fibers.instrument.QuasarURLClassLoader$2.run(QuasarURLClassLoader.java:83)
	at java.security.AccessController.doPrivileged(Native Method)
	at co.paralleluniverse.fibers.instrument.QuasarURLClassLoader.findClass(QuasarURLClassLoader.java:82)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at com.example.Foo.init(Foo.java:123)
	at com.example.Bar.<clinit>(Bar.java:456)
Caused by: java.lang.StackOverflowError
	at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
	at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
	at java.io.File.exists(File.java:819)
	at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:1282)
	at sun.misc.URLClassPath$FileLoader.findResource(URLClassPath.java:1249)
	at sun.misc.URLClassPath.findResource(URLClassPath.java:215)
	at java.net.URLClassLoader$2.run(URLClassLoader.java:569)
	at java.net.URLClassLoader$2.run(URLClassLoader.java:567)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findResource(URLClassLoader.java:566)
	at java.lang.ClassLoader.getResource(ClassLoader.java:1096)
	at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:232)
	at co.paralleluniverse.fibers.instrument.QuasarURLClassLoader.getResourceAsStream(QuasarURLClassLoader.java:106)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.checkClass(MethodDatabase.java:317)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.getOrLoadClassEntry(MethodDatabase.java:183)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.isMethodSuspendable0(MethodDatabase.java:194)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.isMethodSuspendable(MethodDatabase.java:161)
	at co.paralleluniverse.fibers.instrument.InstrumentMethod.isSuspendableCall(InstrumentMethod.java:224)
	at co.paralleluniverse.fibers.instrument.LabelSuspendableCallSitesClassVisitor$1.visitMethodInsn(LabelSuspendableCallSitesClassVisitor.java:64)
	at co.paralleluniverse.asm.ClassReader.a(Unknown Source)
	at co.paralleluniverse.asm.ClassReader.b(Unknown Source)
	at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
	at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
	at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:121)
	at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:88)
	at co.paralleluniverse.fibers.instrument.QuasarURLClassLoader.getResourceAsStream(QuasarURLClassLoader.java:110)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.checkClass(MethodDatabase.java:317)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.getOrLoadClassEntry(MethodDatabase.java:183)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.isMethodSuspendable0(MethodDatabase.java:194)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.isMethodSuspendable(MethodDatabase.java:161)
	at co.paralleluniverse.fibers.instrument.InstrumentMethod.isSuspendableCall(InstrumentMethod.java:224)
	at co.paralleluniverse.fibers.instrument.LabelSuspendableCallSitesClassVisitor$1.visitMethodInsn(LabelSuspendableCallSitesClassVisitor.java:64)
	at co.paralleluniverse.asm.ClassReader.a(Unknown Source)
	at co.paralleluniverse.asm.ClassReader.b(Unknown Source)
	at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
	at co.paralleluniverse.asm.ClassReader.accept(Unknown Source)
	at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:121)
	at co.paralleluniverse.fibers.instrument.QuasarInstrumentor.instrumentClass(QuasarInstrumentor.java:88)
	at co.paralleluniverse.fibers.instrument.QuasarURLClassLoader.getResourceAsStream(QuasarURLClassLoader.java:110)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.checkClass(MethodDatabase.java:317)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.getOrLoadClassEntry(MethodDatabase.java:183)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.isMethodSuspendable0(MethodDatabase.java:194)
	at co.paralleluniverse.fibers.instrument.MethodDatabase.isMethodSuspendable(MethodDatabase.java:161)
	at co.paralleluniverse.fibers.instrument.InstrumentMethod.isSuspendableCall(InstrumentMethod.java:224)
	at co.paralleluniverse.fibers.instrument.LabelSuspendableCallSitesClassVisitor$1.visitMethodInsn(LabelSuspendableCallSitesClassVisitor.java:64)
[snip... the previous 13 lines repeat]

Also, brilliant project!

hollingsworthd avatar Mar 01 '17 02:03 hollingsworthd

I have the same problem. Everything works fine if I use Agent or version 0.7.6, but when I try to load classes by QuasarURLClassLoader or QuasarURLClassLoaderHelper i got StackOverflowException. The problem is in recursive class instrumenting in current string.

andbul avatar Apr 04 '17 19:04 andbul