Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-675

(GSS)[7.0.z]Memory Leaks KieScanner with instances of "ZipKieModule"

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Major Major
    • None
    • 7.0.0.GA
    • BRE
    • Hide

      1) Instantiate and start a KieScanner instance with version "LATEST".

       String groupId = "com.sample.rules";
              String artifactId = "sampleProject";
              String version = "LATEST";
              KieServices kieServices = KieServices.Factory.get();
              ReleaseId releaseId = kieServices.newReleaseId(groupId, artifactId, version);
              KieContainer kieContainer = kieServices.newKieContainer(releaseId);
              KieScanner kieScanner = kieServices.newKieScanner(kieContainer);
              kieScanner.start(1000L);
      

      You can observe the first KieModule added (1.1.4):

       [main] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar
      

      2. Generate 7 new kjars with the same version 1.1.4:

      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar]
      
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4}
      

      At this time, we could observe that only 4 instances of "org.drools.compiler.kie.builder.impl.ZipKieModule" are managed, releasing the older instances from memory.

      3. Generate 6 new kjars bumping the version from 1.1.5 to 1.1.11:

      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.5,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.5\sampleProject-1.1.5.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.6,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.6\sampleProject-1.1.6.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.7,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.7\sampleProject-1.1.7.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.8,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.8\sampleProject-1.1.8.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.10,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.10\sampleProject-1.1.10.jar]
      [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.11,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.11\sampleProject-1.1.11.jar]
      
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.5}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.5=com.sample.rules:sampleProject:jar:1.1.6}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.6=com.sample.rules:sampleProject:jar:1.1.7}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.7=com.sample.rules:sampleProject:jar:1.1.8}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.8=com.sample.rules:sampleProject:jar:1.1.10}
      [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.10=com.sample.rules:sampleProject:jar:1.1.11}
      

      At this time, we can observe that every new artifact generates a new instance of "org.drools.compiler.kie.builder.impl.ZipKieModule" in heap, and this isn´t released from memory that eventually leading to Out Of Memory Exception.

      Show
      1) Instantiate and start a KieScanner instance with version "LATEST". String groupId = "com.sample.rules" ; String artifactId = "sampleProject" ; String version = "LATEST" ; KieServices kieServices = KieServices.Factory.get(); ReleaseId releaseId = kieServices.newReleaseId(groupId, artifactId, version); KieContainer kieContainer = kieServices.newKieContainer(releaseId); KieScanner kieScanner = kieServices.newKieScanner(kieContainer); kieScanner.start(1000L); You can observe the first KieModule added (1.1.4): [main] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar 2. Generate 7 new kjars with the same version 1.1.4: [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.4,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.4\sampleProject-1.1.4.jar] [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.4} At this time, we could observe that only 4 instances of "org.drools.compiler.kie.builder.impl.ZipKieModule" are managed, releasing the older instances from memory. 3. Generate 6 new kjars bumping the version from 1.1.5 to 1.1.11: [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.5,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.5\sampleProject-1.1.5.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.6,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.6\sampleProject-1.1.6.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.7,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.7\sampleProject-1.1.7.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.8,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.8\sampleProject-1.1.8.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.10,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.10\sampleProject-1.1.10.jar] [Timer-0] INFO org.drools.compiler.kie.builder.impl.KieRepositoryImpl - KieModule was added: ZipKieModule[releaseId=com.sample.rules:sampleProject:1.1.11,file=C:\Mave\apache-maven-3.2.5\repository\com\sample\rules\sampleProject\1.1.11\sampleProject-1.1.11.jar] [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.4=com.sample.rules:sampleProject:jar:1.1.5} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.5=com.sample.rules:sampleProject:jar:1.1.6} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.6=com.sample.rules:sampleProject:jar:1.1.7} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.7=com.sample.rules:sampleProject:jar:1.1.8} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.8=com.sample.rules:sampleProject:jar:1.1.10} [Timer-0] INFO org.kie.api.builder.KieScanner - The following artifacts have been updated: {com.sample.rules:sampleProject:1.1.10=com.sample.rules:sampleProject:jar:1.1.11} At this time, we can observe that every new artifact generates a new instance of "org.drools.compiler.kie.builder.impl.ZipKieModule" in heap, and this isn´t released from memory that eventually leading to Out Of Memory Exception.

      Memory Leaks with instances of "org.drools.compiler.kie.builder.impl.ZipKieModule" everytime a new kjar is generated

              mfusco@redhat.com Mario Fusco
              rhn-support-abhumbe Abhijit Humbe
              Tibor Zimányi Tibor Zimányi
              Tibor Zimányi Tibor Zimányi
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: