We’ve identified a memory leak in Drools when using JPAKnowledgeService.loadStatefulKnowledgeSession.

We’ve raised the issue here https://issues.jboss.org/browse/JBRULES-3303?focusedCommentId=12647082#comment-12647082

 

The problem is that the InputMarshaller ends up registering a listener on the knowledge base twice, but only cleans up one of them when the session is disposed. This results in the KnowledgeBase keeping a reference to the session and leaking memory.

 

I’ve done an analysis of it and the fix appears to be changing InputMarshaller line 204 from

session.setKnowledgeRuntime(new StatefulKnowledgeSessionImpl(session));        

to

new StatefulKnowledgeSessionImpl(session);

 

The sessionImpl calls session.setKnowledgeRuntime() during the constructor.

 

I’ve attached a fuller explanation to the issue and there is sample code there as well.

 

It would be great if this could be applied to the 5.3 branch as we need this fix in order to be able to deploy our application.

 

Thanks,

 

Thomas

 




**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster@nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************