Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0037852Openbravo ERP02. Master data managementpublic2018-02-07 13:492018-03-02 21:18
gorkaion 
markmm82 
urgentmajoralways
closedfixed 
5
 
3.0PR18Q2 
dmiguelez
Core
No
0037852: VariantChDescUpdateProcessor fails with OutOfMemoryError when there are many products to update /view.php?id=752#c600
The process to update the characteristics description using the import entry fails if there are many products to update.
1 Go to Product Characteristics window.
2 If none exists create a Characteristic and a Value.
3 Click on Add to Product button.
4 Select all products and click done.
5 check that the process is slow, in some scenarios it even fails with a OutOfMemoryError.
Several fixes that can be applied:

1. The VariantChDescUpdateProcessor does never clear the session. Do it after each product is updated:

            process.update(productIds.getString(i), null);
            OBDal.getInstance().flush();
            OBDal.getInstance().getSession().clear();

2. ProductCharacteristicValueEventHandler creates an import entry with all the products. It could have some limit and one import entry for each 100 products. So if 600 products are updated then 6 import entries are created.

3. The VariantChDescUpdateProcess does refresh of each ProductCharacteristic and ProductCharacteristicValue. Is should be checked if these refreshes are really needed.
No tags attached.
related to defect 0037798 closed markmm82 Add Characteristic to Product does not update the Characteristic Description 
related to defect 0049524 closed igor_trebol ProductCharacteristicValueEventHandler creates and hold a lock on 100 products 
patch issue37852.patch (1,878) 2018-02-07 14:00
https://issues.openbravo.com/file_download.php?file_id=11556&type=bug
Issue History
2018-02-07 13:49gorkaionNew Issue
2018-02-07 13:49gorkaionAssigned To => Triage Finance
2018-02-07 13:49gorkaionModules => Core
2018-02-07 13:49gorkaionResolution time => 1519772400
2018-02-07 13:49gorkaionTriggers an Emergency Pack => No
2018-02-07 13:49gorkaionIssue generated from0037798
2018-02-07 13:49gorkaionRelationship addedrelated to 0037798
2018-02-07 14:00gorkaionFile Added: issue37852.patch
2018-02-07 14:35PracticsIssue Monitored: Practics
2018-02-07 14:59markmm82Statusnew => scheduled
2018-02-07 15:17markmm82Assigned ToTriage Finance => markmm82
2018-02-08 17:52markmm82Note Added: 0102276
2018-02-15 16:38hgbotCheckin
2018-02-15 16:38hgbotNote Added: 0102440
2018-02-15 16:38hgbotCheckin
2018-02-15 16:38hgbotNote Added: 0102441
2018-02-15 16:39dmiguelezStatusscheduled => resolved
2018-02-15 16:39dmiguelezFixed in SCM revision => https://code.openbravo.com/erp/devel/pi/rev/5c01854254bb6fe0bb0b5949d73ac73aa01131b8 [^]
2018-02-15 16:39dmiguelezResolutionopen => fixed
2018-02-15 16:40dmiguelezReview Assigned To => dmiguelez
2018-02-15 16:40dmiguelezNote Added: 0102442
2018-02-15 16:40dmiguelezStatusresolved => closed
2018-02-15 16:40dmiguelezFixed in Version => 3.0PR18Q2
2018-02-15 16:42hgbotCheckin
2018-02-15 16:42hgbotNote Added: 0102443
2018-02-15 17:23hgbotCheckin
2018-02-15 17:23hgbotNote Added: 0102446
2018-02-16 12:08hgbotCheckin
2018-02-16 12:08hgbotNote Added: 0102458
2018-02-22 12:48hgbotCheckin
2018-02-22 12:48hgbotNote Added: 0102594
2018-02-22 12:48hgbotCheckin
2018-02-22 12:48hgbotNote Added: 0102595
2018-02-22 18:19hudsonbotCheckin
2018-02-22 18:19hudsonbotNote Added: 0102767
2018-02-22 18:19hudsonbotCheckin
2018-02-22 18:19hudsonbotNote Added: 0102768
2018-02-22 18:19hudsonbotCheckin
2018-02-22 18:19hudsonbotNote Added: 0102769
2018-02-22 18:19hudsonbotCheckin
2018-02-22 18:19hudsonbotNote Added: 0102773
2018-03-02 21:18hudsonbotCheckin
2018-03-02 21:18hudsonbotNote Added: 0102944
2022-06-15 16:40aferrazRelationship addedrelated to 0049524

Notes
(0102276)
markmm82   
2018-02-08 17:52   
Test Plan
1 Go to Product Characteristics window.
2 If none exists create a Characteristic and a Value.
3 Click on Add to Product button.
4 Select all products and click done.
5 check that the process goes fast and you don't get any failures.
(0102440)
hgbot   
2018-02-15 16:38   
Repository: erp/devel/pi
Changeset: 5c01854254bb6fe0bb0b5949d73ac73aa01131b8
Author: Mark <markmm82 <at> gmail.com>
Date: Fri Feb 09 09:29:04 2018 -0500
URL: http://code.openbravo.com/erp/devel/pi/rev/5c01854254bb6fe0bb0b5949d73ac73aa01131b8 [^]

Fix for issue 37852: VariantChDescUpdateProcessor fails with OutOfMemoryError
when there are many products to update

The process to update the characteristics description using the import entry was
failing if there are many products to update.

Here some reasons causing this issue:
1. The VariantChDescUpdateProcessor wasn't clearing the session.
2. ProductCharacteristicValueEventHandler creates an import entry with all the
   products instead of having some limit.
3. The VariantChDescUpdateProcess was refreshing each ProductCharacteristic and
   ProductCharacteristicValue. These refreshes aren't really needed.

As solution to this issue, were fixed the three points explained above:
1. The VariantChDescUpdateProcessor is clearing the session.
2. ProductCharacteristicValueEventHandler creates an import entry with a defined
   limit (currently 100) of products instead of passing the entire product list.
3. Was removed refreshing of the objects.

---
M src/org/openbravo/event/ProductCharacteristicValueEventHandler.java
M src/org/openbravo/materialmgmt/VariantChDescUpdateProcess.java
M src/org/openbravo/materialmgmt/VariantChDescUpdateProcessor.java
---
(0102441)
hgbot   
2018-02-15 16:38   
Repository: erp/devel/pi
Changeset: 877547db1c2da0b3700ff32563b9f3c1ebb2f20a
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Feb 15 16:37:07 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/877547db1c2da0b3700ff32563b9f3c1ebb2f20a [^]

Related to Issue 37852. Code Review changes.

* Changed import entry size from 3 to 100
* Created productSubListIds as a JSONArray from the start instead of
  converting it again
* Added logger and log error message
* Moved try-cacth to beginning-end of the block

---
M src/org/openbravo/event/ProductCharacteristicValueEventHandler.java
---
(0102442)
dmiguelez   
2018-02-15 16:40   
Code Review + Testing Ok
(0102443)
hgbot   
2018-02-15 16:42   
Repository: erp/devel/pi
Changeset: c67f0ce334d34e604e37a3e11213149ea1c830b0
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Feb 15 16:42:01 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/c67f0ce334d34e604e37a3e11213149ea1c830b0 [^]

Related to issue 37852. Changed Exception name to e

---
M src/org/openbravo/event/ProductCharacteristicValueEventHandler.java
---
(0102446)
hgbot   
2018-02-15 17:23   
Repository: erp/devel/api-checks
Changeset: ca59136ab09f99d9def5da14b587a0a2d4c8ac4b
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Feb 15 17:22:53 2018 +0100
URL: http://code.openbravo.com/erp/devel/api-checks/rev/ca59136ab09f99d9def5da14b587a0a2d4c8ac4b [^]

Related to Issue 37852: False API Change fix.

The logger has been changed to use org.slf4j.Logger
instead of import org.apache.log4j.Logger

---
M java/reference/java.japi.gz
---
(0102458)
hgbot   
2018-02-16 12:08   
Repository: erp/devel/pi
Changeset: 3615cc2bb421b6b8a42b295569e6b470643856de
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Fri Feb 16 12:08:35 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/3615cc2bb421b6b8a42b295569e6b470643856de [^]

Related to Issue 37852. Removed wrong import of Log class and changed
variable to use the proper org.slf4j.Logger class

---
M src/org/openbravo/event/ProductCharacteristicValueEventHandler.java
---
(0102594)
hgbot   
2018-02-22 12:48   
Repository: erp/devel/api-checks
Changeset: 12d876e8e3cfd97fcf74034d5744bfbb52315465
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Feb 22 12:47:41 2018 +0100
URL: http://code.openbravo.com/erp/devel/api-checks/rev/12d876e8e3cfd97fcf74034d5744bfbb52315465 [^]

Related to Issue 37852. API Change because Logger variable
has been moved from protected to private.

---
M java/reference/java.japi.gz
---
(0102595)
hgbot   
2018-02-22 12:48   
Repository: erp/devel/pi
Changeset: e14339104a700718580afe3ce83f5bdfb9f5af49
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Feb 22 10:04:21 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/e14339104a700718580afe3ce83f5bdfb9f5af49 [^]

Related to Issue 37852. Changed definition of Logger from protected
to private static

---
M src/org/openbravo/event/ProductCharacteristicValueEventHandler.java
---
(0102767)
hudsonbot   
2018-02-22 18:19   
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/980a6ad5bbf5 [^]
Maturity status: Test
(0102768)
hudsonbot   
2018-02-22 18:19   
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/980a6ad5bbf5 [^]
Maturity status: Test
(0102769)
hudsonbot   
2018-02-22 18:19   
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/980a6ad5bbf5 [^]
Maturity status: Test
(0102773)
hudsonbot   
2018-02-22 18:19   
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/980a6ad5bbf5 [^]
Maturity status: Test
(0102944)
hudsonbot   
2018-03-02 21:18   
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/05dece3dc80b [^]
Maturity status: Test