You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by "vaibhav-logik (via GitHub)" <gi...@apache.org> on 2026/07/16 14:42:19 UTC

[I] StackOverflowError in BetaNode.networkUpdated() [incubator-kie-drools]

vaibhav-logik opened a new issue, #6812:
URL: https://github.com/apache/incubator-kie-drools/issues/6812

   Caused by: java.lang.StackOverflowError
   	at org.drools.core.reteoo.BetaNode.equals(BetaNode.java:628)
   	at org.drools.core.common.UpdateContext.isVisiting(UpdateContext.java:33)
   	at org.drools.core.reteoo.BetaNode.networkUpdated(BetaNode.java:525)
   	at org.drools.core.reteoo.BetaNode.networkUpdated(BetaNode.java:526)
   	at org.drools.core.reteoo.BetaNode.networkUpdated(BetaNode.java:526)
   	at org.drools.core.reteoo.BetaNode.networkUpdated(BetaNode.java:526)
   	at org.drools.core.reteoo.BetaNode.networkUpdated(BetaNode.java:526)
   .........
   
   
   Test case 
   rule "101 - Test Rule"
   no-loop true
   	when
   		$field2: PicklistField(getName()=="field2" && getHasValue())
   		$field3: PicklistField(getName()=="field3" && getHasValue())
   		$field4: PicklistField(getName()=="field4" && getHasValue())
   		$field5: PicklistField(getName()=="field5" && getHasValue())
   		$field6: PicklistField(getName()=="field6" && getHasValue())
   		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")
   			)
   			&& 
   			(
   				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")
   			)
   			&& 
   			(
   				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")
   			)
   			&& 
   			(
   				PicklistField(getName()=="field2" && getStringValue() != "X")
   				|| PicklistField(getName()=="field3" && getStringValue() != "X")
   				|| PicklistField(getName()=="field4" && getStringValue() != "X")
   				|| PicklistField(getName()=="field5" && getStringValue() != "X")
   			)
   			&&
   			(
   				PicklistField(getName()=="field2" && getStringValue() != "X")
   				|| PicklistField(getName()=="field3" && getStringValue() != "X")
   				|| PicklistField(getName()=="field4" && getStringValue() != "X")
   				|| PicklistField(getName()=="field5" && getStringValue() != "X")
   			)
   			&&
   			(
   				PicklistField(getName()=="field2" && getStringValue() != "X")
   				|| PicklistField(getName()=="field3" && getStringValue() != "X")
   				|| PicklistField(getName()=="field4" && getStringValue() != "X")
   				|| PicklistField(getName()=="field5" && getStringValue() != "X")
   			)
   		)
   	then
   	end


-- 
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.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


Re: [I] StackOverflowError in BetaNode.networkUpdated() [incubator-kie-drools]

Posted by "vaibhav-logik (via GitHub)" <gi...@apache.org>.
vaibhav-logik commented on issue #6812:
URL: https://github.com/apache/incubator-kie-drools/issues/6812#issuecomment-5036440938

   > [@vaibhav-logik](https://github.com/vaibhav-logik) Can you please share more context? Which drools version are you using?
   
   we are using 7.68.0.Final


-- 
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


Re: [I] StackOverflowError in BetaNode.networkUpdated() [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
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


Re: [I] StackOverflowError in BetaNode.networkUpdated() [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas commented on issue #6812:
URL: https://github.com/apache/incubator-kie/issues/6812#issuecomment-5726322283

   Closing for now. If you have an update or feedback, feel free to post a comment.


-- 
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


Re: [I] StackOverflowError in BetaNode.networkUpdated() [incubator-kie]

Posted by "tkobayas (via GitHub)" <gi...@apache.org>.
tkobayas closed issue #6812: StackOverflowError in BetaNode.networkUpdated()
URL: https://github.com/apache/incubator-kie/issues/6812


-- 
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


Re: [I] StackOverflowError in BetaNode.networkUpdated() [incubator-kie-drools]

Posted by "yesamer (via GitHub)" <gi...@apache.org>.
yesamer commented on issue #6812:
URL: https://github.com/apache/incubator-kie-drools/issues/6812#issuecomment-4993844240

   @vaibhav-logik Can you please share more context? Which drools version are you using?


-- 
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


Re: [I] StackOverflowError in BetaNode.networkUpdated() [incubator-kie]

Posted by "vaibhav-logik (via GitHub)" <gi...@apache.org>.
vaibhav-logik commented on issue #6812:
URL: https://github.com/apache/incubator-kie/issues/6812#issuecomment-5201999495

   Thank you @tkobayas  - will surely try and update here


-- 
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