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

Two functions with Janino compiler end up with out of memory error

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.0.0.GA
    • Fix Version/s: 4.0.2
    • Component/s: drools-compiler
    • Labels:
      None
    • Environment:

      Ubuntu Feisty, JDK 1.4 or 1.5, Drools Snapshot

      Description

      Compiling a simple rules file containing two functions with janino causes an out of memory error.
      Rules file example :
      package test

      function boolean func1() {
      return true;
      }

      function boolean func2() {
      return true;
      }

      rule "test"
      when
      Object()
      then
      System.out.println("fired");
      end

      and the code that generate the error :

      package test;

      import java.io.IOException;
      import java.io.InputStreamReader;
      import java.util.Properties;

      import org.drools.compiler.DroolsParserException;
      import org.drools.compiler.PackageBuilder;
      import org.drools.compiler.PackageBuilderConfiguration;

      public class Test {

      public static void main (String[] args) {
      Properties properties = new Properties();
      properties.setProperty("drools.dialect.java.compiler",
      "JANINO");
      PackageBuilderConfiguration pkgBuilderCfg = new PackageBuilderConfiguration(properties);
      PackageBuilder builder = new PackageBuilder(pkgBuilderCfg);
      try

      { builder.addPackageFromDrl(getSource()); }

      catch (DroolsParserException e)

      { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }

      }

      private static InputStreamReader getSource()

      { return new InputStreamReader(Test.class.getResourceAsStream( "Sample.drl" )); }

      }
      After profiling, I identified that the problematic line is the 146 one in class JaninoJavaCompiler. It causes the loadIClass method to loop with a cycle that I don't understand. Placing a breakpoint on the line 91 of JaninoJavaCompiler class permit to observe the loop iterations.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  mark.proctor Mark Proctor
                  Reporter:
                  pplr Pierre Paysant-Le Roux
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: