KieRepository has an internal data structure where it store the KieModules deployed in it. At the moment those KieModules remain there indefinitely even if they are no longer useful and this could be a potential OutOfMemory cause.
Fixed by https://github.com/droolsjbpm/drools/commit/43930b285574549fa9d9e8810862bf1306937f36
This is a perm gen leak fix, so I asked Mario to immediately cherry-pick into 6.0.x in order to include it in ER7.
Mario Fusco <mario.fusco> updated the status of jira DROOLS-381 to Reopened
Unfortunately I found that the solution I implemented (wrapping the KieModules stored by the KieRepository with WeakReferences) doesn't work well as I hoped so I had to rollback it. In particular it doesn't play well with CDI and indeed it made to randomly fail org.drools.compiler.cdi.KieBaseInjectionTest. This is because in that case there's no KieContainer immediately referencing a KieModule, but when weld tries to create one the corresponding KieModule could be already garbage collected and then no longer present in the KieRepository. For the same reason I think that any automatic eviction policy cannot work because we cannot know if it is actually going to evict a KieModule that could be necessary at a later time. Even if I hoped to avoid that, I think that the only solution to this problem is to add a removeKieModule(ReleaseId) method to the public API of the KieRepository allowing the user to explicitly remove a given KieModule.
Fixed by https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/342a3b24e0bb66af48f6811d7f4066f00f907d36 and https://github.com/droolsjbpm/drools/commit/88672e348ed9d32c3f74683e91f727c80754350f implementing a method to explicitly remove a no longer used KieModule from the KieRepository
Cherry-picked into 6.0.x: https://github.com/droolsjbpm/droolsjbpm-knowledge/commit/342a3b24e0b http://github.com/droolsjbpm/drools/commit/d5640b39b
Mario Fusco <mario.fusco> updated the status of jira DROOLS-381 to Resolved
Verified that KieRepository.removeKieModule(ReleaseId) works on BRMS 6.0.0 ER7.