Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-14534

Circular dependency cause a stack overflow

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • None
    • Marshalling
    • Hide

      Use repository : https://github.com/wfink/infinispan.playground.ickle/tree/CircularDependency

      Branch CircularDependency
      build and use the following command `mvn package exec:java -Dexec.mainClass="org.infinispan.wfink.playground.ickle.hotrod.CompanyQueryHotRodClient"`
      Folder HotRodClient will use dedicated Marshaller
      Folder NativeIndexAnnotation will use the @AutoProtoSchemaBuilder

       

      Show
      Use repository : https://github.com/wfink/infinispan.playground.ickle/tree/CircularDependency Branch CircularDependency build and use the following command `mvn package exec:java -Dexec.mainClass="org.infinispan.wfink.playground.ickle.hotrod.CompanyQueryHotRodClient"` Folder HotRodClient will use dedicated Marshaller Folder NativeIndexAnnotation will use the @AutoProtoSchemaBuilder  

      If an embedded entity use a circular dependency, the example is Company{Employee[]} Employee{Company} the invocation of put will end in a stack overflow.
      It does not matter whether the Marshalling is done with custom Marshaller or the @AutoProtoSchemaBuilder is used.

      Error with @AutoProtoSchemaBuilder

      java.lang.reflect.InvocationTargetException
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:566)
          at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:293)
          at java.lang.Thread.run (Thread.java:829)
      Caused by: java.lang.StackOverflowError
          at org.infinispan.protostream.impl.TagWriterImpl$OutputStreamNoBufferEncoder.writeVarint32 (TagWriterImpl.java:728)
          at org.infinispan.protostream.impl.TagWriterImpl$Encoder.writeUInt32Field (TagWriterImpl.java:303)
          at org.infinispan.protostream.impl.TagWriterImpl.writeInt32 (TagWriterImpl.java:138)
          at org.infinispan.wfink.playground.ickle.hotrod.domain.Company$__Marshaller_122420a9663802783129e8afc10a8c94510b1eadac2a59113d3afcfc2c5eb858.write (Company$__Marshaller_122420a9663802783129e8afc10a8c94510b1eadac2a59113d3afcfc2c5eb858.java:112)
          at org.infinispan.wfink.playground.ickle.hotrod.domain.Company$__Marshaller_122420a9663802783129e8afc10a8c94510b1eadac2a59113d3afcfc2c5eb858.write (Company$__Marshaller_122420a9663802783129e8afc10a8c94510b1eadac2a59113d3afcfc2c5eb858.java:15)
          at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.marshall (ProtobufTagMarshallerDelegate.java:27)
          at org.infinispan.protostream.annotations.impl.GeneratedMarshallerBase.writeMessage (GeneratedMarshallerBase.java:33)
          at org.infinispan.protostream.annotations.impl.GeneratedMarshallerBase.writeNestedMessage (GeneratedMarshallerBase.java:43)
          at org.infinispan.wfink.playground.ickle.hotrod.domain.Employee$__Marshaller_889ea1c1f15d1245561a51233659a97474058a605ce5882698073ad951204a79.write (Employee$__Marshaller_889ea1c1f15d1245561a51233659a97474058a605ce5882698073ad951204a79.java:132)
          at org.infinispan.wfink.playground.ickle.hotrod.domain.Employee$__Marshaller_889ea1c1f15d1245561a51233659a97474058a605ce5882698073ad951204a79.write (Employee$__Marshaller_889ea1c1f15d1245561a51233659a97474058a605ce5882698073ad951204a79.java:15)
          at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.marshall (ProtobufTagMarshallerDelegate.java:27)
          at org.infinispan.protostream.annotations.impl.GeneratedMarshallerBase.writeMessage (GeneratedMarshallerBase.java:33)
          at org.infinispan.protostream.annotations.impl.GeneratedMarshallerBase.writeNestedMessage (GeneratedMarshallerBase.java:43)
          at org.infinispan.wfink.playground.ickle.hotrod.domain.Company$__Marshaller_122420a9663802783129e8afc10a8c94510b1eadac2a59113d3afcfc2c5eb858.write (Company$__Marshaller_122420a9663802783129e8afc10a8c94510b1eadac2a59113d3afcfc2c5eb858.java:126)
          at org.infinispan.wfink.playground.ickle.hotrod.domain.Company$__Marshaller_122420a9663802783129e8afc10a8c94510b1eadac2a59113d3afcfc2c5eb858.write (Company$__Marshaller_122420a9663802783129e8afc10a8c94510b1eadac2a59113d3afcfc2c5eb858.java:15)
          at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.marshall (ProtobufTagMarshallerDelegate.java:27)
          at org.infinispan.protostream.annotations.impl.GeneratedMarshallerBase.writeMessage (GeneratedMarshallerBase.java:33)
          at org.infinispan.protostream.annotations.impl.GeneratedMarshallerBase.writeNestedMessage (GeneratedMarshallerBase.java:43)
          at org.infinispan.wfink.playground.ickle.hotrod.domain.Employee$__Marshaller_889ea1c1f15d1245561a51233659a97474058a605ce5882698073ad951204a79.write (Employee$__Marshaller_889

       

      Error with dedicated Marshaller implementation:

      java.lang.reflect.InvocationTargetException
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
          at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
          at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke (Method.java:566)
          at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:293)
          at java.lang.Thread.run (Thread.java:829)
      Caused by: java.lang.StackOverflowError
          at org.infinispan.protostream.impl.TagWriterImpl.getProtoStreamWriter (TagWriterImpl.java:283)
          at org.infinispan.protostream.impl.TagWriterImpl.getProtoStreamWriter (TagWriterImpl.java:283)
          at org.infinispan.protostream.impl.TagWriterImpl.getProtoStreamWriter (TagWriterImpl.java:283)

       

       

       

              fercoli@redhat.com Fabio Massimo Ercoli
              fercoli@redhat.com Fabio Massimo Ercoli
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: