You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Ratnesh Upadhyay (Jira)" <ji...@apache.org> on 2026/06/12 12:25:00 UTC
[jira] [Commented] (OFBIZ-13165) StackOverflowError when adding item to an order in order manager app
[ https://issues.apache.org/jira/browse/OFBIZ-13165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18088532#comment-18088532 ]
Ratnesh Upadhyay commented on OFBIZ-13165:
------------------------------------------
[~abuomar] [~jleroux]
I've tried to replicate this issue based upon following notes from mailing list:
# Set webstore warehouse Configuration as follows.
# OFBiz E-Commerce Store [ID:9000]
# Check Inventory -> NO,
# Require Inventory -> NO.
# Create a Sales order ( set currency to SAR ).
# Add a new item with id ( GZ-1005)
Using the steps outlined above, I was able to reproduce the issue, which eventually resulted in a StackOverflowError:
{code:java}
at org.apache.ofbiz.service.engine.GroovyEngine.runSync(GroovyEngine.java:110)
at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:429)
at org.apache.ofbiz.service.ServiceDispatcher.runSync(ServiceDispatcher.java:244)
at org.apache.ofbiz.service.GenericDispatcherFactory$GenericDispatcher.runSync(GenericDispatcherFactory.java:77)
at org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker.performAction(ProductPromoWorker.java:1217)
at org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker.performAction(ProductPromoWorker.java:1185)
at org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker.runProductPromoRules(ProductPromoWorker.java:935)
at org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker.runProductPromos(ProductPromoWorker.java:520)
at org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker.doPromotions(ProductPromoWorker.java:350)
at org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker.doPromotions(ProductPromoWorker.java:315)
at org.apache.ofbiz.order.shoppingcart.ShoppingCartItem.setQuantity(ShoppingCartItem.java:1234)
at org.apache.ofbiz.order.shoppingcart.ShoppingCart.removeCartItem(ShoppingCart.java:1090)
at org.apache.ofbiz.order.shoppingcart.ShoppingCartItem.makeItem(ShoppingCartItem.java:821)
at org.apache.ofbiz.order.shoppingcart.ShoppingCartItem.makeItem(ShoppingCartItem.java:681)
at org.apache.ofbiz.order.shoppingcart.ShoppingCartItem.makeItem(ShoppingCartItem.java:658)
at org.apache.ofbiz.product.product.promo.ProductPromoActionServices.productGWP(ProductPromoActionServices.groovy:198)
at jdk.internal.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
2026-06-12 16:05:38,992 |jsse-nio-8443-exec-9 |ProductPromoCondServices :157|E| Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.
org.apache.ofbiz.service.GenericServiceException: Error running Groovy method [getOrderedSummaryInformation] in Groovy file [component://order/src/main/groovy/org/apache/ofbiz/order/order/OrderServicesScript.groovy]: (java.lang.StackOverflowError) {code}
On further investigation, I found that the issue occurs during promotion recalculation and Gift-With-Purchase (GWP) cleanup processing.
When the system evaluates a promotion, it tries to automatically add the GWP item to the cart. However, if the GWP product cannot be added—for example, because it does not have a valid price in the cart currency or it fails inventory validation—the item is never created successfully.
Since the GWP item is missing from the cart, the promotion engine assumes the promotion has not yet been applied and triggers another promotion recalculation. This causes the system to repeatedly attempt to add the same GWP item, resulting in an infinite loop that eventually leads to the error we are seeing.
I've started working to fix the issue.
> StackOverflowError when adding item to an order in order manager app
> --------------------------------------------------------------------
>
> Key: OFBIZ-13165
> URL: https://issues.apache.org/jira/browse/OFBIZ-13165
> Project: OFBiz
> Issue Type: Bug
> Components: order
> Affects Versions: 24.09.01
> Environment: Ofbiz version = Trunk..
> JVM = Temurin 21.
> OS = Linux ( Fedora 40 ).
>
> Reporter: Omar Abu-Arab
> Assignee: Ratnesh Upadhyay
> Priority: Major
> Attachments: ofbiz.log, ofbiz.log.1, ofbiz.log.2, ofbiz.log.3
>
> Original Estimate: 168h
> Remaining Estimate: 168h
>
> I configured the webstore with
> Check Inventory = N
> Require Inventory = N
> And started to create new Sales Order from the order manager application,
> At adding a new product to this order
> I got a stackoverflow error.
> By the way the error appears in the trunk version is with a different cause
> Currently the cause includes the following ( but there is another different one , I still following up and will report it soon if get assured).
> {color:#000000} at org.apache.ofbiz.order.shoppingcart.ShoppingCartItem.setQuantity(ShoppingCartItem.java:1210) ~[main/:?] {color}
> at org.apache.ofbiz.order.shoppingcart.ShoppingCart.removeCartItem(ShoppingCart.java:1078) ~[main/:?]
> at org.apache.ofbiz.order.shoppingcart.ShoppingCartItem.makeItem(ShoppingCartItem.java:797) ~[main/:?]
> at org.apache.ofbiz.order.shoppingcart.ShoppingCartItem.makeItem(ShoppingCartItem.java:657) ~[main/:?]
> at org.apache.ofbiz.order.shoppingcart.ShoppingCartItem.makeItem(ShoppingCartItem.java:634) ~[main/:?]
> at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321) ~[groovy-4.0.22.jar:4.0.22]
> at org.apache.ofbiz.product.product.promo.ProductPromoActionServices.productGWP(ProductPromoActionServices.groovy:198) ~[main/:?]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)