
At SAP Support, we recently found a problem in some "Buy X Get X" promotions in SAP Commerce versions 2211.16 and 2211.17. When setting up partner-product promotions with identical product containers, the system sometimes ended up in an infinite loop. This caused high CPU usage and memory problems. The issue was traced back to a bug in Drools' logic.
In this blog, we’ll explain what went wrong, why it happened, and how to fix it.
What Was the Problem? Slow Performance and Infinite Loops
The issue mainly affected promotions like "Buy X Get X Discount" or "Buy X Get X Free." If two containers in the promotion had the same products or categories, Drools (the rules engine) couldn’t process them correctly.
This led to infinite loops in these parts of the system:
The infinite loop caused high CPU and memory usage. If your storefront slowed down—especially when changing product quantities—you may have experienced this issue. You can confirm it by checking the thread dump.
What Caused the Problem? A Bug in Drools
The problem happened because Drools couldn’t handle two containers with the same products or categories in the promotion rules. Instead of processing them properly, it got stuck in a loop, which used up system resources.
How to Fix It? Best Practices to Avoid Loops
We identified the problem and recommend the following steps to avoid it:
Don’t Use Identical Containers
Avoid creating promotions with two containers that have the same products or categories.
Instead, use one container in the Conditions area. Then, reference the same container for both "Qualifying Products" and "Partner Products" in the Actions area.
Upcoming Fix in Future Releases
SAP is working on a fix to stop users from creating these kinds of promotions by mistake.
This fix will be included in version 2211.22 of SAP Commerce Cloud.
Be Careful with Custom Actions
If you customize the promotion rules, make sure to fully consume all products (OrderEntries) that match the conditions.
Partially using the products can cause errors like NullPointerException
SAP reported this issue to the Drools team, and they’re working on it.
Final Thoughts
Following these steps can help you avoid infinite loop issues in your partner-product promotions. If you’re using versions 2211.16 or 2211.17, review your promotions to ensure they don’t include identical containers.
The fix coming in version 2211.22 will add extra protection against these errors. Until then, using the best practices outlined here will keep your SAP Commerce setup running smoothly.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
3 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |