Openbravo Issue Tracking System - Modules
View Issue Details
0038853ModulesNot Posted Transactionspublic2018-06-28 10:002020-02-28 06:03
egoitz 
Sandrahuguet 
urgentmajoralways
closedfixed 
5
 
 
markmm82
0038853: Report not posted consume a lot of memory
The execution of the report not posted window produces a high memory usage if there are lot of records to show.
That produces severe performance problems issues on the system ending consuming finally all the postgresql connections.
Execute the report on an environment with big amount of data.


The method retaining memory is:

getGridData
** Use ScrollableResults instead of list()
** Set limit to the query fetching the records from active tables in Accounting Schema Tables.
No tags attached.
png reportNOtposted.png (46,596) 2018-06-28 10:00
https://issues.openbravo.com/file_download.php?file_id=11907&type=bug
png
Issue History
2018-06-28 10:00egoitzNew Issue
2018-06-28 10:00egoitzAssigned To => Triage Finance
2018-06-28 10:00egoitzFile Added: reportNOtposted.png
2018-06-28 10:00egoitzModules => Core
2018-06-28 10:00egoitzTriggers an Emergency Pack => No
2018-06-28 10:01egoitzResolution time => 1531951200
2018-06-28 10:09SandrahuguetAssigned ToTriage Finance => AtulOpenbravo
2018-06-28 11:39martinsdanIssue Monitored: martinsdan
2018-06-28 13:28SandrahuguetProjectOpenbravo ERP => Modules
2018-06-28 13:28SandrahuguetCategory09. Financial management => Not Posted Transactions
2018-07-01 20:34AtulOpenbravoStatusnew => scheduled
2018-07-09 15:44AtulOpenbravoReview Assigned To => Sandrahuguet
2018-07-09 15:44AtulOpenbravoProposed Solution updated
2018-07-09 17:10hgbotCheckin
2018-07-09 17:10hgbotNote Added: 0105684
2018-07-09 17:10hgbotStatusscheduled => resolved
2018-07-09 17:10hgbotResolutionopen => fixed
2018-07-09 17:10hgbotFixed in SCM revision => http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/8c17a25759e2a81720608ef43ea8490d05c74345 [^]
2018-07-09 17:10hgbotCheckin
2018-07-09 17:10hgbotNote Added: 0105685
2018-07-09 17:18SandrahuguetNote Added: 0105686
2018-07-09 17:18SandrahuguetStatusresolved => closed
2018-07-27 10:05egoitzNote Added: 0105970
2018-07-27 10:05egoitzStatusclosed => new
2018-07-27 10:05egoitzResolutionfixed => open
2018-07-27 10:38ngarciaIssue Monitored: ngarcia
2018-07-31 08:44AtulOpenbravoStatusnew => scheduled
2018-08-06 11:19hgbotCheckin
2018-08-06 11:19hgbotNote Added: 0106163
2018-08-06 11:20SandrahuguetNote Added: 0106164
2018-08-06 11:20SandrahuguetStatusscheduled => resolved
2018-08-06 11:20SandrahuguetResolutionopen => fixed
2018-08-06 11:20SandrahuguetStatusresolved => closed
2018-10-29 21:28egoitzNote Added: 0107646
2018-10-29 21:28egoitzStatusclosed => new
2018-10-29 21:28egoitzResolutionfixed => open
2018-11-05 14:29vmromanosStatusnew => scheduled
2018-11-05 14:29vmromanosAssigned ToAtulOpenbravo => markmm82
2018-11-13 09:12hgbotCheckin
2018-11-13 09:12hgbotNote Added: 0107868
2018-11-13 09:41SandrahuguetStatusscheduled => resolved
2018-11-13 09:41SandrahuguetResolutionopen => fixed
2018-11-13 09:42SandrahuguetNote Added: 0107869
2018-11-13 09:42SandrahuguetStatusresolved => closed
2018-11-28 16:57egoitzAssigned Tomarkmm82 => Sandrahuguet
2018-11-28 16:57egoitzStatusclosed => new
2018-11-28 16:57egoitzResolutionfixed => open
2018-12-13 11:11SandrahuguetStatusnew => scheduled
2018-12-20 09:10hgbotCheckin
2018-12-20 09:10hgbotNote Added: 0108683
2018-12-20 09:10hgbotStatusscheduled => resolved
2018-12-20 09:10hgbotResolutionopen => fixed
2018-12-20 09:10hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/8c17a25759e2a81720608ef43ea8490d05c74345 [^] => http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/bc5f285ab1addd14a52efb3b6653d3d2ac0ddec2 [^]
2018-12-20 09:14SandrahuguetReview Assigned ToSandrahuguet => markmm82
2018-12-21 08:35hgbotCheckin
2018-12-21 08:35hgbotNote Added: 0108714
2018-12-27 04:13hgbotCheckin
2018-12-27 04:13hgbotNote Added: 0108758
2018-12-27 04:15markmm82Note Added: 0108759
2018-12-27 04:15markmm82Statusresolved => closed
2019-01-04 09:08hgbotCheckin
2019-01-04 09:08hgbotNote Added: 0108826
2020-02-28 06:03AtulOpenbravoIssue cloned0043361

Notes
(0105684)
hgbot   
2018-07-09 17:10   
Repository: erp/mods/org.openbravo.financialmgmt.accounting.report.notposted
Changeset: 8c17a25759e2a81720608ef43ea8490d05c74345
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Mon Jul 09 19:06:38 2018 +0530
URL: http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/8c17a25759e2a81720608ef43ea8490d05c74345 [^]

Fixes Issue 38853:Report not posted consume a lot of memory

** Use ScrollableResults instead of list
** Set limit to query as endRow as every time query retreived
all rows and when counter reached endRow, result was returned.
** Avoid list size() method, made use of IsEmpty() instead.

---
M src/org/openbravo/financialmgmt/accounting/report/notposted/NotPostedDocumentsDataSource.java
---
(0105685)
hgbot   
2018-07-09 17:10   
Repository: erp/mods/org.openbravo.financialmgmt.accounting.report.notposted
Changeset: 853f11444b1443020b6daceefb7712cafed1dd3b
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Mon Jul 09 17:10:32 2018 +0200
URL: http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/853f11444b1443020b6daceefb7712cafed1dd3b [^]

related to issue 38853 update module version

---
M src-db/database/sourcedata/AD_MODULE.xml
---
(0105686)
Sandrahuguet   
2018-07-09 17:18   
Code review + testing OK
(0105970)
egoitz   
2018-07-27 10:05   
Ticket reopened as the problem is still reproducible.
High memory usage when printing the reports.

I saw that you added the scrollable but you are not doing a clear, so the memory usage will be the same but it the problem will appear later.
(0106163)
hgbot   
2018-08-06 11:19   
Repository: erp/mods/org.openbravo.financialmgmt.accounting.report.notposted
Changeset: 8cee7c2afae4e707a638a561f388dff5b5b09ca4
Author: Atul Gaware <atul.gaware <at> openbravo.com>
Date: Wed Aug 01 22:31:44 2018 +0530
URL: http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/8cee7c2afae4e707a638a561f388dff5b5b09ca4 [^]

Related to Issue 38853:Report not posted consume a lot of memory

** Use evict to detach object from session.

---
M src/org/openbravo/financialmgmt/accounting/report/notposted/NotPostedDocumentsDataSource.java
---
(0106164)
Sandrahuguet   
2018-08-06 11:20   
Code review + testing OK
(0107646)
egoitz   
2018-10-29 21:28   
The issue is still reproducible after apply the patches
(0107868)
hgbot   
2018-11-13 09:12   
Repository: erp/mods/org.openbravo.financialmgmt.accounting.report.notposted
Changeset: d6cf08d194bfcb9f72102178584bf12e851e6364
Author: Mark <markmm82 <at> gmail.com>
Date: Fri Nov 09 00:39:13 2018 -0500
URL: http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/d6cf08d194bfcb9f72102178584bf12e851e6364 [^]

Related to issue 38853: Report not posted consume a lot of memory

** Always get the table to be processed by getting a new instance from the schemaTable ID.
** Extract to entityByTableName variable the value of ModelProvider.getInstance().
   getEntityByTableName(table.getDBTableName()) to avoid call it more than once for the same table.
** Extract to entityHasDocumentTypeProperty the value of ModelProvider.getInstance().
   getEntityByTableName(table.getDBTableName()).hasProperty("documentType") to avoid call it
   more than once for the same table.
** Extract to defaultDocumentTypeForTable variable the value of the default doctype of the processing
   table instead of get it every time when scroling the scrollable if the table hasn't
   document type property.
** Use evict to detach schemaTable object from session.
** Clear the session each 100 records in the scrollable.

---
M src/org/openbravo/financialmgmt/accounting/report/notposted/NotPostedDocumentsDataSource.java
---
(0107869)
Sandrahuguet   
2018-11-13 09:42   
Code review + testing OK
(0108683)
hgbot   
2018-12-20 09:10   
Repository: erp/mods/org.openbravo.financialmgmt.accounting.report.notposted
Changeset: bc5f285ab1addd14a52efb3b6653d3d2ac0ddec2
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Thu Dec 20 09:10:00 2018 +0100
URL: http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/bc5f285ab1addd14a52efb3b6653d3d2ac0ddec2 [^]

fixed issue 38853 Report not posted consume a lot of memory

**add a preference to limit the number of scrolls in the report
**add pagination in document type combo

---
M src/org/openbravo/financialmgmt/accounting/report/notposted/NotPostedDocumentsDataSource.java
---
(0108714)
hgbot   
2018-12-21 08:35   
Repository: erp/mods/org.openbravo.financialmgmt.accounting.report.notposted
Changeset: 7535cff488c347d963625fde452517b15886b293
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Fri Dec 21 08:35:09 2018 +0100
URL: http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/7535cff488c347d963625fde452517b15886b293 [^]

related to issue 38853 Fix eclipse warnings for CI

*create a proper variable to the new scrollable

---
M src/org/openbravo/financialmgmt/accounting/report/notposted/NotPostedDocumentsDataSource.java
---
(0108758)
hgbot   
2018-12-27 04:13   
Repository: erp/mods/org.openbravo.financialmgmt.accounting.report.notposted
Changeset: 73625def499210331897282ad8708986ec354533
Author: Mark <markmm82 <at> gmail.com>
Date: Wed Dec 26 10:51:26 2018 -0500
URL: http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/73625def499210331897282ad8708986ec354533 [^]

Related to issue 38853: Code review refactor

Use the new log4j API.
Use StringUtils.isEmpty to ask for empty strings
Use StringBuilder to build HQL query.
Removed the doctype variable and was added directly to the documentTypes

---
M src/org/openbravo/financialmgmt/accounting/report/notposted/NotPostedDocumentsDataSource.java
---
(0108759)
markmm82   
2018-12-27 04:15   
Code review + testing OK
(0108826)
hgbot   
2019-01-04 09:08   
Repository: erp/mods/org.openbravo.financialmgmt.accounting.report.notposted
Changeset: 8cf7bc0f4e6387dcf5562aa1dfb9673ef7c26b9e
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Fri Jan 04 09:08:36 2019 +0100
URL: http://code.openbravo.com/erp/mods/org.openbravo.financialmgmt.accounting.report.notposted/rev/8cf7bc0f4e6387dcf5562aa1dfb9673ef7c26b9e [^]

related to issue 38853 missing preference

---
A src-db/database/sourcedata/AD_REF_LIST.xml
---