Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0025684Openbravo ERPI. Performancepublic2014-02-07 08:112014-02-13 07:16
shuehner 
alostale 
immediatecriticalhave not tried
closedfixed 
5
3.0MP22.2 
3.0PR14Q2 
alostale
Core
No
0025684: FIC is calculating all vaues of combo's in several cases where it is not needed.
During perf-debugging in a client we found 2 cases where the FIC is calculating list of values for (big) combo's where this is not needed.

It is known that this can be worked around by redefining the affected columns in the ad. But in this case this is a logic bug fic imho it should be fixed there.

Both cases have their logic in FIC function computeColumnValues around lines 555+ 576 (2 places affected)

a.) The logic in FIC is computing combo-values for all columns in case of mode=CHANGE, when visibleProperties is null.
This can be trigger in the UI when having open a window in form fiew, then switching to another openbravo window and coming back to the first window.
This coming back to first window, does trigger a FIC call in mode=change which does not have the visibleProperties object with values.

b.) The logic in FIC is taking into account isDisplayed, isShownInGrid, isShownInStatus and if none of those are set does not compute all values of a combo for this column. However this logic does not take into account isactive flag. So having a ad_field entry with isactive=n but isdisplayeD=Y does trigger computation of the combo.

The attached patch does implement the change a.) taken into account visibleProperties==null.
Also it adds some debugging code which makes it much easier to find out why a column has it combo-values calculated without needing to go into the ad to check all the flags manually.

AMO: has a prototype patch to implement part b.) which is also refactoring the if-logic a bit as it is very hard to read in its current form.


3.) part: Another idea to improve performance for fic combo-calculation
In case of a column not being visible sometimes it still needs the combo-values calculated to get a default-value to be used on inserts.
However in this case only a single value (the final default-value is needed).
Here the potentially big memory-spike of having all millions of combo values in memory can be avoided by adapting the logic.

AMO: has also a prototype patch to implement this part 3.)

Note: for the cases triggering oom's in the client a+b are sufficient to avoid the known cases.
However part 3.) should also be very useful to reduce memory consumption in other not yet observed cases.

NOTE: This is a candidate to be backported, but should get some extra maturing first.
see Description of a+b above
a.) Change logic to disable the part of the if related to visibleProperties to make it in-effective in case of visibleProperties == null. The rest of the if-conditions still need to be executed !
b.) Change logic to also take isactive into account for the part of the if related to visibility only. The second part of the if regarding default values is different and may or not need to get the same change.
In the observed case the change would only be needed for the display part which should also be the safer option as it reduces the scope of the change.
Performance
diff fic_prototype_change_a.diff (4,584) 2014-02-07 08:18
https://issues.openbravo.com/file_download.php?file_id=6691&type=bug
diff fix25684Part_b.diff (3,118) 2014-02-07 12:16
https://issues.openbravo.com/file_download.php?file_id=6692&type=bug
diff fix25684Part_3.diff (6,177) 2014-02-07 12:19
https://issues.openbravo.com/file_download.php?file_id=6693&type=bug
Issue History
2014-02-07 08:11shuehnerNew Issue
2014-02-07 08:11shuehnerAssigned To => AugustoMauch
2014-02-07 08:11shuehnerModules => Core
2014-02-07 08:11shuehnerTriggers an Emergency Pack => No
2014-02-07 08:14alostaleTag Attached: Performance
2014-02-07 08:18shuehnerFile Added: fic_prototype_change_a.diff
2014-02-07 12:05alostaleAssigned ToAugustoMauch => alostale
2014-02-07 12:16marvintmFile Added: fix25684Part_b.diff
2014-02-07 12:19marvintmFile Added: fix25684Part_3.diff
2014-02-12 17:01hgbotCheckin
2014-02-12 17:01hgbotNote Added: 0064079
2014-02-12 17:01hgbotCheckin
2014-02-12 17:01hgbotNote Added: 0064080
2014-02-12 17:01hgbotCheckin
2014-02-12 17:01hgbotNote Added: 0064081
2014-02-12 17:01hgbotCheckin
2014-02-12 17:01hgbotNote Added: 0064082
2014-02-12 17:01alostaleStatusnew => scheduled
2014-02-12 17:01alostalefix_in_branch => pi
2014-02-12 17:02alostaleStatusscheduled => resolved
2014-02-12 17:02alostaleFixed in Version => 3.0MP32
2014-02-12 17:02alostaleFixed in SCM revision => https://code.openbravo.com/erp/devel/pi/rev/001ce480684b29e5f8b839adc67d35d5bf48fa47 [^]
2014-02-12 17:02alostaleResolutionopen => fixed
2014-02-12 17:10alostaleReview Assigned To => alostale
2014-02-12 17:10alostaleNote Added: 0064083
2014-02-12 17:10alostaleStatusresolved => closed
2014-02-12 17:12alostaleStatusclosed => new
2014-02-12 17:12alostaleResolutionfixed => open
2014-02-12 17:12alostaleFixed in Version3.0MP32 =>
2014-02-12 17:13alostaleNote Edited: 0064083bug_revision_view_page.php?bugnote_id=0064083#r5443
2014-02-12 17:13alostaleStatusnew => scheduled
2014-02-12 17:13alostaleStatusscheduled => resolved
2014-02-12 17:13alostaleResolutionopen => fixed
2014-02-12 17:13alostaleStatusresolved => closed
2014-02-12 17:13alostaleFixed in Version => 3.0MP32
2014-02-13 07:16hudsonbotCheckin
2014-02-13 07:16hudsonbotNote Added: 0064201
2014-02-13 07:16hudsonbotCheckin
2014-02-13 07:16hudsonbotNote Added: 0064202
2014-02-13 07:16hudsonbotCheckin
2014-02-13 07:16hudsonbotNote Added: 0064203
2014-02-13 07:16hudsonbotCheckin
2014-02-13 07:16hudsonbotNote Added: 0064204

Notes
(0064079)
hgbot   
2014-02-12 17:01   
Repository: erp/devel/pi
Changeset: ed6df2f35307ff9c59d6cebeb1bf30f7c8f6c2db
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Feb 07 12:46:29 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/ed6df2f35307ff9c59d6cebeb1bf30f7c8f6c2db [^]

related to bug 25684: solves case a
  don't compute unneeded combos on CHANGE mode when visibleProperties is null

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
---
(0064080)
hgbot   
2014-02-12 17:01   
Repository: erp/devel/pi
Changeset: 6198177e1c6178d4467687c4963609a402540ba1
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Feb 07 13:00:18 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/6198177e1c6178d4467687c4963609a402540ba1 [^]

related to issue 25684: solves case b

  do not compute inactive combos if they are not required

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
---
(0064081)
hgbot   
2014-02-12 17:01   
Repository: erp/devel/pi
Changeset: 82bb222117bcdf35562698bb78177291116f8041
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Feb 07 13:01:43 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/82bb222117bcdf35562698bb78177291116f8041 [^]

related to issue 25684: solves case 3

  don't generate complete JSON for combos when only one value is required

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/FKComboUIDefinition.java
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java
M src/org/openbravo/erpCommon/utility/ComboTableData.java
---
(0064082)
hgbot   
2014-02-12 17:01   
Repository: erp/devel/pi
Changeset: 001ce480684b29e5f8b839adc67d35d5bf48fa47
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Feb 11 10:55:13 2014 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/001ce480684b29e5f8b839adc67d35d5bf48fa47 [^]

related to issue 25684: solves case 3

---
M modules/org.openbravo.client.application/src/org/openbravo/client/application/window/FormInitializationComponent.java
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/reference/UIDefinition.java
M src/org/openbravo/erpCommon/utility/ComboTableData.java
---
(0064083)
alostale   
2014-02-12 17:10   
(edited on: 2014-02-12 17:13)
Code reviewed.

Verified combos that are now not calculated or only their single record make sense.
Verified single record calculation returns the expected value.

Improvements tested in Sales Order window:
* Sales Order Header tab
  - 13 combos are not computed at all
  - 2 combos are calculated only one record
* Sales Order Line tab
  - 9 combos are not computed at all
  - 6 combos are calculated only one record

(0064201)
hudsonbot   
2014-02-13 07:16   
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/76fb3237bc3a [^]
Maturity status: Test
(0064202)
hudsonbot   
2014-02-13 07:16   
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/76fb3237bc3a [^]
Maturity status: Test
(0064203)
hudsonbot   
2014-02-13 07:16   
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/76fb3237bc3a [^]
Maturity status: Test
(0064204)
hudsonbot   
2014-02-13 07:16   
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/76fb3237bc3a [^]
Maturity status: Test