You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "tkobayas (via GitHub)" <gi...@apache.org> on 2026/08/05 02:54:49 UTC
Re: [I] StackOverflowError in BetaNode.networkUpdated() [incubator-kie]
tkobayas commented on issue #6812:
URL: https://github.com/apache/incubator-kie/issues/6812#issuecomment-5186989097
@vaibhav-logik
Nested ORs can create huge permutations in KieBase building. In this case, The exists() has 6 AND groups: 3 groups with 5 OR alternatives + 3 groups with 4 OR alternatives. It results in 5 * 5 * 5 * 4 * 4 * 4 = 8,000 permutations. Then it creates a linear chain of 8,000 NotNodes, which will trigger StackOverflowError/OutOfMemoryError.
I recommend to rewrite the rule. `exists(A && B)` is semantically equivalent to `exists(A) && exists(B)`. So the rule can be split into separate exists() conditions:
```
exists(
PicklistField(getName()=="field2" && getStringValue() != "X")
|| PicklistField(getName()=="field3" && getStringValue() != "X")
|| PicklistField(getName()=="field4" && getStringValue() != "X")
|| PicklistField(getName()=="field5" && getStringValue() != "X")
|| PicklistField(getName()=="field6" && getStringValue() != "X")
)
exists(
PicklistField(getName()=="field2" && getStringValue() != "X")
|| PicklistField(getName()=="field3" && getStringValue() != "X")
|| PicklistField(getName()=="field4" && getStringValue() != "X")
|| PicklistField(getName()=="field5" && getStringValue() != "X")
|| PicklistField(getName()=="field6" && getStringValue() != "X")
)
... repeat for each group
```
It would significantly reduce the use of stack/heap. Please try.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org