Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0051645Openbravo ERP04. Warehouse managementpublic2023-02-20 10:412023-03-16 13:32
shuehner 
tonialcaide 
normalmajorhave not tried
closedfixed 
5
 
PR23Q2 
Core
No
0051645: MaterialReceiptPending.processPurchaseOrder causes idle in transactions to be left (in some cases)
Abandoned connection logging points to this file for opening connection marked as suspect:

https://gitlab.com/openbravo/product/openbravo/-/blob/master/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java#L326 [^]

Checking that function processPurchaseOrder it opens it via getTransactionConnection.

It does not have a finally block to 'always' close this connection.

However it has several early "return" statements which neither manage this properly:
https://gitlab.com/openbravo/product/openbravo/-/blob/master/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java#L370 [^]
https://gitlab.com/openbravo/product/openbravo/-/blob/master/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java#L400 [^]
https://gitlab.com/openbravo/product/openbravo/-/blob/master/src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java#L417 [^]

Likely each of those is a candidate for causing this.

Note: While fixing this please also fix up the bad logging (printStackTrace) in that function.
Should be possible to reproduce by:
a.) Configuring to lob abandoned connections
db.pool.logAbandoned=true
db.pool.suspectTimeout=60
# 60s value chose just to aid in debugging

b.) Trigger one of the 3 validations listed above + wait at least 60s

c.) Check catalina.out, or tomcat console output

Either:
- add properly connection handing to each early return which is missing it
- Or add finally block to whole function managing centrally.
No tags attached.
Issue History
2023-02-20 10:41shuehnerNew Issue
2023-02-20 10:41shuehnerAssigned To => Triage Omni WMS
2023-02-20 10:41shuehnerModules => Core
2023-02-20 10:41shuehnerTriggers an Emergency Pack => No
2023-02-20 16:22tonialcaideAssigned ToTriage Omni WMS => tonialcaide
2023-02-22 11:21hgbotNote Added: 0146864
2023-03-16 13:32hgbotResolutionopen => fixed
2023-03-16 13:32hgbotStatusnew => closed
2023-03-16 13:32hgbotNote Added: 0147605
2023-03-16 13:32hgbotFixed in Version => PR23Q2
2023-03-16 13:32hgbotNote Added: 0147606

Notes
(0146864)
hgbot   
2023-02-22 11:21   
Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/829 [^]
(0147605)
hgbot   
2023-03-16 13:32   
Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/829 [^]
(0147606)
hgbot   
2023-03-16 13:32   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 084c6e3a9cfed942bd26cf41ef106cecd030cbe0
Author: Toni Alcaide <antonio.alcaide@openbravo.com>
Date: 16-03-2023 12:32:49
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/084c6e3a9cfed942bd26cf41ef106cecd030cbe0 [^]

Fixed ISSUE-51645: MaterialReceiptPending.processPurchaseOrder causes idle in transactions to be left (in some cases)

---
M src/org/openbravo/erpCommon/ad_forms/MaterialReceiptPending.java
---