Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-6633

Memory leak in KieRepository.RemoveModule

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Major
    • None
    • 7.56.0.Final
    • build
    • None
    • 2021 Week 43-45 (from Oct 25)
    • NEW
    • NEW

    Description

      We are using drools in one of our batch jobs where this a different set of rules submitted for each job. We are facing a incremental growth in ram after each run. Is there a way to dispose the rules in KieBase after each run as they wont be required for the next job.
       
      Our code to read the rule file(Before each batch job  and create container is as follows :
      private static KieFileSystem getKieFileSystem(String rulesFileName,String tenant,String filePath) throws Exception

      { KieFileSystem kieFileSystem = kieServices.newKieFileSystem(); kieFileSystem.write(ResourceFactory.newFileResource(filePath+tenant+"//"+rulesFileName+"")); return kieFileSystem; }

       public static KieContainer getKieContainer(String rulesFileName, String tenant, String filePath) throws Exception

      { KieBuilder kb = kieServices.newKieBuilder(getKieFileSystem(rulesFileName,tenant,filePath)); kb.buildAll(); KieModule kieModule = kb.getKieModule(); KieContainer kContainer = kieServices.newKieContainer(kieModule.getReleaseId()); return kContainer;  }

      Code we tried to remove the rules from memory  after each batch job (None of it worked) :

      1. KieFileSystem.delete(filePath+tenant+"//"rulesFileName""); // Removes file but rules stay in ram
      2. kieServices.getRepository().removeModule(kContainer. getReleaseId()); // removes module from repository but rules stay in memory still
      3. kiesession.dispose() and kieContainer.dispose() // Rules stay in memory still

       
      Any help regarding this would be great.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            suhas_kumar01 Suhas Kumar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: