Drools StafulKnowledgeSession in JBoss ESB runtime always contains MessageImpl objects

Solution Verified - Updated -

Issue

  • In this scenario users are using org.jboss.soa.esb.actions.BusinessRulesProcessor as an action pipeline in JBoss ESB application to inject facts into a StafulKnowledgeSession (ksession), e.g.:
...
    <action class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
     name="BusinessProcessorActionClass">
     <property name="ruleSet" value="/rules/simplerule.drl"/>
     <property name="stateful" value="true"/>
     <property name="ruleEventProcessingType" value="STREAM"/>
     <property name="object-paths">
      <object-path entry-point="before-or-after" esb="body.BeforeOrAfterFact"/>
      <object-path entry-point="config" esb="body.Config"/>
     </property>
    </action>
...

Users have configured a listener which logs when a fact is inserted or retracted to/from ksession. It can be seen from those logs that the MessageImpl object that is going through the pipeline gets inserted, however it never gets retracted once the rules have finished firing and the pipeline ends, which leads to the ksession eventually taking up all the memory on the server. Here is a log showing a message coming into the pipeline, being inserted which causes more insertions/retractions and then the pipeline ends:

2015-07-31 06:59:14,130 INFO  [com.sample.action.log.FactLoggerAction] [WorkManager(2)-31] 
...
2015-07-31 06:59:14,130 INFO  [com.sample.action.log.FactLoggerAction] [WorkManager(2)-31] BRMS : Before Or After Manager Service : Log Inbound (9b860979-9439-486e-99e5-41674db9b7f7)
2015-07-31 06:59:14,130 INFO  [com.sample.action.log.FactLoggerAction] [WorkManager(2)-31] 
...
2015-07-31 06:59:19,518 INFO  [com.sample.action.log.FactLoggerAction] [WorkManager(2)-31] Fact inserted: org.jboss.internal.soa.esb.message.format.xml.MessageImpl
2015-07-31 06:59:19,518 INFO  [com.sample.action.log.FactLoggerAction] [WorkManager(2)-31] Fact inserted: com.sample.action.log.BeforeOrAfterEnvelopeFact
...
  • As it can be seen MessageImpl gets inserted but not retracted. When a heap dump is taken and analysed, users for a specific use case can see 100,000+ number of MessageImpl objects are sitting around in the ksession. Is there some way to retract the MessageImpl immediately after the rules are fired?

  • If it is possible to retract the MessageImpl during JBoss ESB action pipeline execution , could there be any repercussions for such activity ?

Environment

  • Red Hat JBoss SOA Platform (SOA-P)
    • 5.3.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In