Project: 	
  | View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | ||||||||
| 0027170 | ||||||||
| Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
| defect | [Openbravo ERP] A. Platform | major | always | 2014-07-23 20:34 | 2015-05-19 01:33 | |||
| Reporter | jecharri | View Status | public | |||||
| Assigned To | eduardo_Argal | |||||||
| Priority | urgent | Resolution | fixed | Fixed in Version | ||||
| Status | closed | Fix in branch | Fixed in SCM revision | 03198cfe71df | ||||
| Projection | none | ETA | none | Target Version | 3.0PR15Q3 | |||
| OS | Any | Database | Any | Java version | ||||
| OS Version | Database version | Ant version | ||||||
| Product Version | SCM revision | |||||||
| Merge Request Status | ||||||||
| Review Assigned To | eduardo_Argal | |||||||
| OBNetwork customer | OBPS | |||||||
| Web browser | Google Chrome | |||||||
| Modules | Core | |||||||
| Support ticket | 29895 | |||||||
| 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(); } } }  | |||||||
| Tags | Performance | |||||||
| Attached Files | ||||||||
		  Relationships		[ Relation Graph ] 
		[ Dependency Graph ] 
			 | 
||||||||
  | 
||||||||
  		Notes	 | 
|
| 
				(0075982) eduardo_Argal (viewer) 2015-03-25 19:16  | 
	See attached patch | 
| 
				(0077519) hgbot (developer) 2015-05-18 11:12  | 
	
		Repository: erp/devel/pi Changeset: 03198cfe71dfaaba2ff641430be536b6efc5eb84 Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com> Date: Mon May 18 11:06:08 2015 +0200 URL: http://code.openbravo.com/erp/devel/pi/rev/03198cfe71dfaaba2ff641430be536b6efc5eb84 [^] Fixes issue 27170: Performance problems in CharacteristicValueEventHandler onUpdate method has been changed to execute an update query instead of two OBCriteria queries, which improves the performance of the event handler. --- M src/org/openbravo/event/CharacteristicValueEventHandler.java ---  | 
| 
				(0077520) eduardo_Argal (viewer) 2015-05-18 11:17  | 
	
		Fix was tested and verified in a customer environment. Code reviewed and tested. Now after modifying existing value or inserting new one system throws one single update sentence, which saves most of the memory consumption  | 
| 
				(0077547) hudsonbot (viewer) 2015-05-19 01:33  | 
	
		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/bdd788358e65 [^] Maturity status: Test  | 
  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 | OBNetwork customer | => Yes | 
| 2014-07-23 20:34 | jecharri | Web browser | => Google Chrome | 
| 2014-07-23 20:34 | jecharri | Modules | => Core | 
| 2014-07-23 20:34 | jecharri | Support ticket | => 29895 | 
| 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 | View Revisions | 
| 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 | View Revisions | 
| 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 | |
| Copyright © 2000 - 2009 MantisBT Group |