Openbravo Issue Tracking System - Openbravo ERP | ||||||||||||
View Issue Details | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
0027170 | Openbravo ERP | A. Platform | public | 2014-07-23 20:34 | 2015-05-19 01:33 | |||||||
Reporter | jecharri | |||||||||||
Assigned To | eduardo_Argal | |||||||||||
Priority | urgent | Severity | major | Reproducibility | always | |||||||
Status | closed | Resolution | fixed | |||||||||
Platform | OS | 5 | OS Version | |||||||||
Product Version | ||||||||||||
Target Version | 3.0PR15Q3 | Fixed in Version | ||||||||||
Merge Request Status | ||||||||||||
Review Assigned To | eduardo_Argal | |||||||||||
OBNetwork customer | ||||||||||||
Web browser | Google Chrome | |||||||||||
Modules | Core | |||||||||||
Support ticket | ||||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0027170: Problem in event handler CharacteristicValueEventHandler.java when you update a characteristics value | |||||||||||
Description | Problem in event handler CharacteristicValueEventHandler.java when you update a characteristics value | |||||||||||
Steps To Reproduce | -In a database with a los of product using product characteristics.Tab "characteristics" inside window "Product" -Login to ERP -Go to "product characteristics" window and select one. -Go to tab "Value" and after selecting a record, modify the code or insert a new one You will see that JAVA starts taking all the memory and the server stops working. The problem is eventhandler CharacteristicValueEventHandler.java because we are doing if (productCharateristic.count() > 0) { for (ProductCharacteristic productch : productCharateristic.list()) { and for (ProductCharacteristicConf conf : productCharateristicsConf.list()) { instead of using ScrollableResults. | |||||||||||
Proposed Solution | public void onUpdate(@Observes EntityUpdateEvent event) { if (!isValidEvent(event)) { return; } final CharacteristicValue chv = (CharacteristicValue) event.getTargetInstance(); chvalueUpdated.set(chv.getId()); // Update all product characteristics configurations with updated code of the characteristic. // Only when product characteristics is not linked with subset. final Entity prodchValue = ModelProvider.getInstance().getEntity( CharacteristicValue.ENTITY_NAME); final Property codeProperty = prodchValue.getProperty(CharacteristicValue.PROPERTY_CODE); if (event.getCurrentState(codeProperty) != event.getPreviousState(codeProperty)) { OBCriteria<ProductCharacteristic> productCharateristic = OBDal.getInstance().createCriteria( ProductCharacteristic.class); productCharateristic.add(Restrictions .isNull(ProductCharacteristic.PROPERTY_CHARACTERISTICSUBSET)); OBContext.setAdminMode(true); try { ScrollableResults productChScroller = productCharateristic.scroll(ScrollMode.FORWARD_ONLY); int i = 0; while (productChScroller.next()) { ProductCharacteristic productch = (ProductCharacteristic) productChScroller.get()[0]; OBCriteria<ProductCharacteristicConf> productCharateristicsConf = OBDal.getInstance() .createCriteria(ProductCharacteristicConf.class); productCharateristicsConf.add(Restrictions.eq( ProductCharacteristicConf.PROPERTY_CHARACTERISTICOFPRODUCT, productch)); productCharateristicsConf.add(Restrictions.eq( ProductCharacteristicConf.PROPERTY_CHARACTERISTICVALUE, chv)); ScrollableResults productChConfScroller = productCharateristicsConf .scroll(ScrollMode.FORWARD_ONLY); while (productChConfScroller.next()) { ProductCharacteristicConf conf = (ProductCharacteristicConf) productChConfScroller .get()[0]; if (chv.getCode() != conf.getCode()) { conf.setCode(chv.getCode()); OBDal.getInstance().save(conf); } } i++; if (i % 100 == 0) { OBDal.getInstance().getSession().clear(); } } } finally { OBContext.restorePreviousMode(); } } } | |||||||||||
Additional Information | ||||||||||||
Tags | Performance | |||||||||||
Relationships |
| |||||||||||
Attached Files | CharacteristicValueEventHandler.diff (4,548) 2015-03-25 19:15 https://issues.openbravo.com/file_download.php?file_id=7936&type=bug | |||||||||||
Issue History | ||||||||||||
Date Modified | Username | Field | Change | |||||||||
2014-07-23 20:34 | jecharri | New Issue | ||||||||||
2014-07-23 20:34 | jecharri | Assigned To | => AugustoMauch | |||||||||
2014-07-23 20:34 | jecharri | Web browser | => Google Chrome | |||||||||
2014-07-23 20:34 | jecharri | Modules | => Core | |||||||||
2014-07-23 20:34 | jecharri | Resolution time | => 1408399200 | |||||||||
2014-07-23 20:34 | jecharri | Triggers an Emergency Pack | => No | |||||||||
2014-07-23 20:39 | jecharri | Web browser | Google Chrome => Google Chrome | |||||||||
2014-07-23 20:39 | jecharri | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=6140#r6140 | |||||||||
2014-07-23 20:51 | jecharri | Web browser | Google Chrome => Google Chrome | |||||||||
2014-07-23 20:51 | jecharri | Proposed Solution updated | ||||||||||
2014-07-23 20:58 | jecharri | Web browser | Google Chrome => Google Chrome | |||||||||
2014-07-23 20:58 | jecharri | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=6141#r6141 | |||||||||
2014-07-24 07:18 | alostale | Tag Attached: Performance | ||||||||||
2014-07-24 07:19 | alostale | Relationship added | has duplicate 0026867 | |||||||||
2014-07-24 07:20 | alostale | Assigned To | AugustoMauch => eduardo_Argal | |||||||||
2014-09-22 16:36 | jonalegriaesarte | Target Version | => 3.0PR15Q1 | |||||||||
2014-09-22 16:37 | jonalegriaesarte | Target Version | 3.0PR15Q1 => 3.0PR14Q4 | |||||||||
2014-09-29 16:12 | jonalegriaesarte | Target Version | 3.0PR14Q4 => 3.0PR15Q1 | |||||||||
2014-10-16 11:36 | eduardo_Argal | Status | new => scheduled | |||||||||
2014-10-16 11:36 | eduardo_Argal | fix_in_branch | => pi | |||||||||
2014-12-22 12:37 | vmromanos | Web browser | Google Chrome => Google Chrome | |||||||||
2014-12-22 12:37 | vmromanos | Target Version | 3.0PR15Q1 => 3.0PR15Q2 | |||||||||
2014-12-22 12:37 | vmromanos | fix_in_branch | pi => | |||||||||
2015-03-25 19:15 | eduardo_Argal | File Added: CharacteristicValueEventHandler.diff | ||||||||||
2015-03-25 19:16 | eduardo_Argal | Note Added: 0075982 | ||||||||||
2015-03-30 13:59 | jonalegriaesarte | Target Version | 3.0PR15Q2 => 3.0PR15Q3 | |||||||||
2015-05-18 11:12 | hgbot | Checkin | ||||||||||
2015-05-18 11:12 | hgbot | Note Added: 0077519 | ||||||||||
2015-05-18 11:12 | hgbot | Status | scheduled => resolved | |||||||||
2015-05-18 11:12 | hgbot | Resolution | open => fixed | |||||||||
2015-05-18 11:12 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/03198cfe71dfaaba2ff641430be536b6efc5eb84 [^] | |||||||||
2015-05-18 11:17 | eduardo_Argal | Review Assigned To | => eduardo_Argal | |||||||||
2015-05-18 11:17 | eduardo_Argal | Note Added: 0077520 | ||||||||||
2015-05-18 11:17 | eduardo_Argal | Status | resolved => closed | |||||||||
2015-05-19 01:33 | hudsonbot | Checkin | ||||||||||
2015-05-19 01:33 | hudsonbot | Note Added: 0077547 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|