Openbravo Issue Tracking System - Retail Modules
View Issue Details
0039767Retail ModulesStoreServerpublic2018-12-06 22:552018-12-10 09:58
mtaal 
mtaal 
normalcriticalhave not tried
closedfixed 
5
 
 
AugustoMauch
No
0039767: Connection Leak in ServerStateBackground process
See attached screenshot, the thread which calls the servers to get the status uses separate threads [1]. If an exception occurs it will not release the connection it retrieved.

[1]
https://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/file/tip/src/org/openbravo/mobile/core/servercontroller/ServerStateBackground.java#l454 [^]
Force an error in the loop somewhere
Add a rollback in a finally/exception block in the try-catch-finally here [1]

[1]
https://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/file/tip/src/org/openbravo/mobile/core/servercontroller/ServerStateBackground.java#l454 [^]
No tags attached.
jpeg WhatsApp Image 2018-12-06 at 19.00.03 (1).jpeg (252,871) 2018-12-06 22:55
https://issues.openbravo.com/file_download.php?file_id=12416&type=bug
jpeg

diff 39767.diff (802) 2018-12-09 14:08
https://issues.openbravo.com/file_download.php?file_id=12417&type=bug
Issue History
2018-12-06 22:55mtaalNew Issue
2018-12-06 22:55mtaalAssigned To => mtaal
2018-12-06 22:55mtaalFile Added: WhatsApp Image 2018-12-06 at 19.00.03 (1).jpeg
2018-12-06 22:55mtaalTriggers an Emergency Pack => No
2018-12-09 14:04mtaalNote Added: 0108347
2018-12-09 14:08mtaalFile Added: 39767.diff
2018-12-09 22:05hgbotCheckin
2018-12-09 22:05hgbotNote Added: 0108348
2018-12-09 22:05hgbotStatusnew => resolved
2018-12-09 22:05hgbotResolutionopen => fixed
2018-12-09 22:05hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/7678179d3b72b5ad4fb73adf50b18218c147b053 [^]
2018-12-09 22:06mtaalReview Assigned To => AugustoMauch
2018-12-10 09:58AugustoMauchNote Added: 0108354
2018-12-10 09:58AugustoMauchStatusresolved => closed

Notes
(0108347)
mtaal   
2018-12-09 14:04   
Can be reproduced by forcing an error for example add this line
      // force NPE
      System.err.println(resp.toString());
in the pingServer method after the declaration of the resp variable.
(0108348)
hgbot   
2018-12-09 22:05   
Repository: erp/pmods/org.openbravo.mobile.core
Changeset: 7678179d3b72b5ad4fb73adf50b18218c147b053
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Sun Dec 09 22:05:12 2018 +0100
URL: http://code.openbravo.com/erp/pmods/org.openbravo.mobile.core/rev/7678179d3b72b5ad4fb73adf50b18218c147b053 [^]

Fixes issue 39767: Connection Leak in ServerStateBackground process
Do rollback and close in case of error and ensure that commit and close is called last if no error

---
M src/org/openbravo/mobile/core/servercontroller/ServerStateBackground.java
---
(0108354)
AugustoMauch   
2018-12-10 09:58   
Code reviewed and verified.

The change itself makes sense, and it makes the code more robust against errors during the ping process.

Note though that the screenshot attached to the issue does not show a memory leak, just a slow execution of the process. Line printed at 12:53:02 states that the connection was returned to the pool.