Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-946

RuleBase serialization fails with StackOverflowError

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 4.0.0.MR2, 4.0.0.MR3
    • Fix Version/s: 6.0.0.Alpha1
    • Component/s: None
    • Labels:
      None

      Description

      I created 920 rules, all in this format, with different values in the string literals.

      rule "Rule_1"
      when
      $g:Parent()
      $c:Child(parent==$g,code=="yyy1")
      Item(parentObject==$c,name=="xxx1", value == "1")
      Item(parentObject==$c,name=="xxx2",value == "1")
      Item(parentObject==$g,name=="xxx3",value == "200")
      then
      System.out.println("2");
      end
      With the following code, I create a RuleBase that I serialize.

      RuleBase ruleBase = RuleBaseFactory.newRuleBase();
      PackageBuilderConfiguration conf = new PackageBuilderConfiguration();
      conf.setCompiler(PackageBuilderConfiguration.JANINO);
      Reader source = new InputStreamReader(PolicyServiceImpl.class.getResourceAsStream(fileName));
      PackageBuilder builder = new PackageBuilder(conf);
      builder.addPackageFromDrl(source);
      Package pkg = builder.getPackage();
      ruleBase.addPackage(pkg);
      //serialize RuleBase
      File outFile = new File(f.getPath() + ".tmp");
      FileOutputStream fout = new FileOutputStream(outFile);
      ObjectOutputStream oos = new ObjectOutputStream(fout);
      oos.writeObject(ruleBase);
      oos.close();

      The serialization fails with the following exception. Otherwise the RuleBase is perfectly fine and working.

      java.lang.StackOverflowError
      at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream$BlockDataOutputStream.write(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java(Compiled Code))
      at java.util.ArrayList.writeObject(ArrayList.java(Compiled Code))
      at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
      at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java(Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Inlined Compiled Code))
      at java.util.ArrayList.writeObject(ArrayList.java(Compiled Code))
      at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
      at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java(Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java(Inlined Compiled Code))
      at java.util.ArrayList.writeObject(ArrayList.java(Compiled Code))
      at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled Code))
      at java.lang.reflect.Method.invoke(Method.java(Compiled Code))
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java(Compiled Code))
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java(Compiled Code))
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java(Inlined Compiled Code))
      (last four lines repeated over 1000 times)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mark.proctor Mark Proctor
              Reporter:
              agattik Alexandre Gattiker (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated: