Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-12699

Avoid stack overflow with Hibernate bytecode transformer

    Details

      Description

      Part of stackoverflow that can occur:

      	at org.hibernate.bytecodetransformer@7.2.4.GA-redhat-00002//org.jboss.as.hibernate.Hibernate51CompatibilityTransformer.transform(Hibernate51CompatibilityTransformer.java:114)
      	at org.jboss.as.server@6.0.16.Final-redhat-00002//org.jboss.as.server.deployment.module.DelegatingClassFileTransformer.transform(DelegatingClassFileTransformer.java:60)
      	at org.jboss.modules.JLIClassTransformer.transform(JLIClassTransformer.java:55)
      	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:503)
      	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
      	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
      	at org.jboss.modules.Module.loadModuleClass(Module.java:731)
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      	at java.base/java.lang.Class.forName0(Native Method)
      	at java.base/java.lang.Class.forName(Class.java:398)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:955)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.SymbolTable.addMergedType(SymbolTable.java:1209)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.Frame.merge(Frame.java:1293)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.Frame.merge(Frame.java:1175)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1613)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1549)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:773)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.readCode(ClassReader.java:2429)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1275)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.accept(ClassReader.java:679)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
      	at org.hibernate.bytecodetransformer@7.2.4.GA-redhat-00002//org.jboss.as.hibernate.Hibernate51CompatibilityTransformer.transform(Hibernate51CompatibilityTransformer.java:114)
      	at org.jboss.as.server@6.0.16.Final-redhat-00002//org.jboss.as.server.deployment.module.DelegatingClassFileTransformer.transform(DelegatingClassFileTransformer.java:60)
      	at org.jboss.modules.JLIClassTransformer.transform(JLIClassTransformer.java:55)
      	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:503)
      	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
      	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
      	at org.jboss.modules.Module.loadModuleClass(Module.java:731)
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      	at java.base/java.lang.Class.forName0(Native Method)
      	at java.base/java.lang.Class.forName(Class.java:398)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:955)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.SymbolTable.addMergedType(SymbolTable.java:1209)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.Frame.merge(Frame.java:1293)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.Frame.merge(Frame.java:1175)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1613)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1549)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:773)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.readCode(ClassReader.java:2429)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1275)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.accept(ClassReader.java:679)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
      	at org.hibernate.bytecodetransformer@7.2.4.GA-redhat-00002//org.jboss.as.hibernate.Hibernate51CompatibilityTransformer.transform(Hibernate51CompatibilityTransformer.java:114)
      	at org.jboss.as.server@6.0.16.Final-redhat-00002//org.jboss.as.server.deployment.module.DelegatingClassFileTransformer.transform(DelegatingClassFileTransformer.java:60)
      	at org.jboss.modules.JLIClassTransformer.transform(JLIClassTransformer.java:55)
      	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:503)
      	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:339)
      	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:126)
      	at org.jboss.modules.Module.loadModuleClass(Module.java:731)
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:247)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      	at java.base/java.lang.Class.forName0(Native Method)
      	at java.base/java.lang.Class.forName(Class.java:398)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:955)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.SymbolTable.addMergedType(SymbolTable.java:1209)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.Frame.merge(Frame.java:1293)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.Frame.merge(Frame.java:1175)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1613)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1549)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:773)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.readCode(ClassReader.java:2429)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1275)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.accept(ClassReader.java:679)
      	at asm.asm@6.2.1.redhat-00001//org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
      	at org.hibernate.bytecodetransformer@7.2.4.GA-redhat-00002//org.jboss.as.hibernate.Hibernate51CompatibilityTransformer.transform(Hibernate51CompatibilityTransformer.java:114)
      	at org.jboss.as.server@6.0.16.Final-redhat-00002//org.jboss.as.server.deployment.module.DelegatingClassFileTransformer.transform(DelegatingClassFileTransformer.java:60)
      	at org.jboss.modules.JLIClassTransformer.transform(JLIClassTransformer.java:55)
      

      Perhaps the Hibernate bytecode transformer also needs to implement https://asm.ow2.io/javadoc/org/objectweb/asm/ClassWriter.html#getCommonSuperClass-java.lang.String-java.lang.String-, as others have mentioned on https://github.com/cglib/cglib/issues/117.

      Also see https://stackoverflow.com/questions/43154658/issue-with-asm-getmergedtype-and-getcommonsuperclass

      Also look at Byteman https://github.com/bytemanproject/byteman/blob/master/agent/src/main/java/org/jboss/byteman/agent/TransformContext.java#L444

      As well as considering if Hibernate transformer really needs to use org.objectweb.asm.ClassWriter.COMPUTE_FRAMES

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  smarlow Scott Marlow
                  Reporter:
                  smarlow Scott Marlow
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: