Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0029936Openbravo ERP09. Financial managementpublic2015-05-20 12:022015-07-16 11:23
egoitz 
umartirena 
urgentmajoralways
closedfixed 
5
 
 
dmiguelez
Core
No
0029936: Java heap error when executing the costing background process with 1024mb on Xmx
Java heap error when executing the costing background process with 1024mb on Xmx
-Configure an environment assigning 1024mb to tomcat on xmx variable.
-Execute the costing backgroudn process

*java heap error is raised
No tags attached.
depends on backport 00299373.0PR15Q2.3 closed umartirena Java heap error when executing the costing background process with 1024mb on Xmx 
depends on backport 00299383.0PR15Q1.6 closed umartirena Java heap error when executing the costing background process with 1024mb on Xmx 
Issue History
2015-05-20 12:02egoitzNew Issue
2015-05-20 12:02egoitzAssigned To => Triage Finance
2015-05-20 12:02egoitzModules => Core
2015-05-20 12:02egoitzResolution time => 1432504800
2015-05-20 12:02egoitzTriggers an Emergency Pack => No
2015-05-20 12:02egoitzAssigned ToTriage Finance => umartirena
2015-05-20 12:34umartirenaRegression level => Production - Confirmed Stable
2015-05-20 12:34umartirenaRegression date => 2015-03-04
2015-05-20 12:34umartirenaRegression introduced in release => 3.0PR15Q1.3
2015-05-20 12:34umartirenaRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/115dc304149663ee5e27d18077840054823b35ca [^]
2015-05-20 12:34umartirenaTriggers an Emergency PackNo => Yes
2015-05-20 12:34umartirenaStatusnew => scheduled
2015-05-20 13:07umartirenaNote Added: 0077597
2015-05-21 08:04umartirenaRegression levelProduction - Confirmed Stable =>
2015-05-21 08:04umartirenaRegression date2015-03-04 =>
2015-05-21 08:04umartirenaRegression introduced in release3.0PR15Q1.3 =>
2015-05-21 08:04umartirenaRegression introduced by commithttps://code.openbravo.com/erp/devel/pi/rev/115dc304149663ee5e27d18077840054823b35ca [^] =>
2015-05-21 08:04umartirenaTriggers an Emergency PackYes => No
2015-05-21 08:04umartirenaNote Edited: 0077597bug_revision_view_page.php?bugnote_id=0077597#r8601
2015-06-03 09:15umartirenaNote Edited: 0077597bug_revision_view_page.php?bugnote_id=0077597#r8735
2015-06-04 17:47hgbotCheckin
2015-06-04 17:47hgbotNote Added: 0078094
2015-06-04 17:47hgbotStatusscheduled => resolved
2015-06-04 17:47hgbotResolutionopen => fixed
2015-06-04 17:47hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/654d4ad1872f1468265ac30de77d055fcd63abde [^]
2015-06-04 18:05dmiguelezReview Assigned To => dmiguelez
2015-06-04 18:05dmiguelezNote Added: 0078097
2015-06-04 18:05dmiguelezStatusresolved => closed
2015-06-06 16:53hudsonbotCheckin
2015-06-06 16:53hudsonbotNote Added: 0078128
2015-07-16 11:23hgbotCheckin
2015-07-16 11:23hgbotNote Added: 0078847

Notes
(0077597)
umartirena   
2015-05-20 13:07   
(edited on: 2015-06-03 09:15)
Test Plan:

-Configure an environment assigning 1024mb to tomcat on xmx variable.
-Execute the costing background process.

We have an environment in which this issue could be tested.

*Realize that Costing Background process works as expected and no java heap error is raised

(0078094)
hgbot   
2015-06-04 17:47   
Repository: erp/devel/pi
Changeset: 654d4ad1872f1468265ac30de77d055fcd63abde
Author: Unai Martirena <unai.martirena <at> openbravo.com>
Date: Tue Jun 02 09:12:55 2015 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/654d4ad1872f1468265ac30de77d055fcd63abde [^]

Fixes bug 29708, Fixes bug 29936: Improve performance and memory problems

2 Problems are happening in Costing Background process:

1) Java Heap error: This problem happens because getTransactions method can load on memory a lot of objects and even an ScrollableResult is being used the following sentence 'OBDal.getInstance().getConnection().setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT)' prevents in fact to scroll properly the ScrollableResult. To avoid this issue the query of getTransactions method has been changed to return only 1000 records. So, instead of calling just once this method it is done once each 1000 records.

Also instead of returning a list of 1000 MaterialTransaction objects, that can be a relatively big amount of objects to load in memory, only the Ids are returned and each id the it is instanced on each iteration.

2) Performance problems: The process has a performance issue because it does a commit on each iteration of the list. Now, this has been changed to do commit every 1000 records, and in case that an exception is raised on a certain iteration a new method has been added in catch clause to calculate the cost of the transactions that have been rolledback but which there were properly calculated.

---
M src/org/openbravo/costing/CostingBackground.java
---
(0078097)
dmiguelez   
2015-06-04 18:05   
Code Review + Testing Ok
(0078128)
hudsonbot   
2015-06-06 16:53   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/7419f65cdeb3 [^]
Maturity status: Test
(0078847)
hgbot   
2015-07-16 11:23   
Repository: erp/backports/3.0PR15Q2.3
Changeset: c82af3582eab289c419b9d42e88e4b19ac058340
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Jul 16 11:22:14 2015 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR15Q2.3/rev/c82af3582eab289c419b9d42e88e4b19ac058340 [^]

Fixes issue 29937: BackPort from issue 29936

---
M src/org/openbravo/costing/CostingBackground.java
---