Out of memory caused by RuleTerminalNodeLeftTuple after upgrade to 7.59.0.Final

111 views
Skip to first unread message

pep...@gmail.com

unread,
Oct 19, 2021, 10:44:51 AM10/19/21
to Drools Usage
Hello

we upgraded from 7.3.0.Final to 7.59.0.Final.

Now we get OutOfMemory exception in Heap space because of endless creation of RuleTerminalNodeLeftTuple objects that belong to a single rule.

I was reading the release notes but found no clue.
Please can you point me to a possible cause?
This was not happenning in 7.3.0.Final.
Is there a safer version between 7.3 and 7.59?
We are afraid what else could happen in our other ~3000 rules.

WORKAROUND:

It is unsettling that there is a workaround.
(rule and stacktrace is provided below) 
When we rewrite the condition
$ac : AssetCard(_parent == $as, groupCode2 in ("A", "B", "C")) @watch(groupCode2)
NOT to use the IN operator but to use ||
$ac : AssetCard(_parent == $as, groupCode2 == "A" || groupCode2 == "B" || groupCode2 == "C") @watch(groupCode2)
it works normally.

CONTEXT:

We upgraded from 7.3.0.Final to 7.59.0.Final in hope to get rid of memory leaks.

With 7.3.0.Final we had problems with KieContainer holding references to Kie sessions, even after sessions were disposed. This (or similar issue) was fixed in 7.2, but still occured.
(https://issues.redhat.com/browse/DROOLS-1655). After upgrading to 7.59.0.Final the problem dissappeared

DETAILS:

It happens after AssetCard object is removed and a new one is inserted (+ parent and child objects are updated/deleted/inserted).
After that, the memory is filled up very fast with millions of RuleTerminalNodeLeftTuple.

The rule
rule "XXX"
  agenda-group "Calculation"
  salience 999999999
  no-loop
when
  $bc : VarBusinessCase()
  $vdt : LocalDateTimeVariable(name == V.validityDateTime, value != null) @watch(value)
  $ovt : LocalDateTimeVariable(name == V.offerValidityTo) @watch(value)
  $as : Asset(_parent == $bc)
  $ac : AssetCard(_parent == $as, groupCode2 in ("A", "B", "C")) @watch(groupCode2)
then
  modify($ovt){setValue($vdt.getValue().plusDays(30))}
end

There is circular @watch(value) and modify($ovt).setValue, but there is also no-loop.

Stack trace
getStagedType:357, TupleSetsImpl (org.drools.core.common)
addInsert:85, TupleSetsImpl (org.drools.core.common)
insertChildLeftTuple:482, PhreakJoinNode (org.drools.core.phreak)
doRightInserts:160, PhreakJoinNode (org.drools.core.phreak)
doNode:67, PhreakJoinNode (org.drools.core.phreak)
switchOnDoBetaNode:569, RuleNetworkEvaluator (org.drools.core.phreak)
evalBetaNode:555, RuleNetworkEvaluator (org.drools.core.phreak)
evalNode:382, RuleNetworkEvaluator (org.drools.core.phreak)
innerEval:342, RuleNetworkEvaluator (org.drools.core.phreak)
outerEval:178, RuleNetworkEvaluator (org.drools.core.phreak)
evaluateNetwork:136, RuleNetworkEvaluator (org.drools.core.phreak)
evaluateNetwork:73, RuleExecutor (org.drools.core.phreak)
evaluateEagerList:681, DefaultAgenda (org.drools.core.common)
fireLoop:863, DefaultAgenda (org.drools.core.common)
internalFireAllRules:816, DefaultAgenda (org.drools.core.common)
fireAllRules:808, DefaultAgenda (org.drools.core.common)
internalFireAllRules:1343, StatefulKnowledgeSessionImpl (org.drools.core.impl)
fireAllRules:1334, StatefulKnowledgeSessionImpl (org.drools.core.impl)
fireAllRules:1322, StatefulKnowledgeSessionImpl (org.drools.core.impl)

Thank you in advance,

Kind regards,

Peter

Toshiya Kobayashi

unread,
Oct 20, 2021, 1:20:08 AM10/20/21
to Drools Usage
Hi Peter,

Could you kindly create and attach a reproducer (= a simple project which reproduces the issue)?

I tried to simulate what you wrote but couldn't reproduce the issue on my end (Just FYI, attached Ex-RuleTerminalNodeLeftTuple-issue-7.59.zip).

Thanks!
Toshiya

2021年10月19日火曜日 23:44:51 UTC+9 pep...@gmail.com:
Ex-RuleTerminalNodeLeftTuple-issue-7.59.zip

Peter Martinovič

unread,
Oct 20, 2021, 1:21:47 PM10/20/21
to drools...@googlegroups.com
Hello Toshiya

Right now I am not able to focus on creating a reproducer, hopefully it will be possible later.

FYI it seems that it does not happen in 7.45.0.Final.

Thank you,

Peter


--
You received this message because you are subscribed to a topic in the Google Groups "Drools Usage" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/drools-usage/vJuK5UBatPg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to drools-usage...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/b08f235b-19c6-43e5-98de-e063e501a20fn%40googlegroups.com.

Peter Martinovič

unread,
Oct 21, 2021, 4:21:42 PM10/21/21
to drools...@googlegroups.com
Hello Toshiya,

Please find the reproducer attached.

Thank you,

Peter


On Wed, Oct 20, 2021 at 7:20 AM Toshiya Kobayashi <toshiyak...@gmail.com> wrote:
--
Ex-RuleTerminalNodeLeftTuple-issue-7.59-4.zip

Toshiya Kobayashi

unread,
Oct 24, 2021, 9:02:58 PM10/24/21
to Drools Usage
Thank you very much for the reproducer, Peter.

I can reproduce the issue with it on my end now. I'll investigate and keep you posted.

Regards,
Toshiya


2021年10月22日金曜日 5:21:42 UTC+9 pep...@gmail.com:

Toshiya Kobayashi

unread,
Oct 27, 2021, 11:01:25 PM10/27/21
to Drools Usage
Filed a JIRA. Will work on it.
Thanks!
Toshiya


2021年10月25日月曜日 10:02:58 UTC+9 Toshiya Kobayashi:
Reply all
Reply to author
Forward
0 new messages