Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0034628Openbravo ERP02. Master data managementpublic2016-11-25 09:042018-02-22 18:18
alostale 
collazoandy4 
urgentmajorrandom
closedfixed 
5
 
3.0PR18Q2 
dmiguelez
Core
No
0034628: Manage variants can return unexpected values
When filtering concurrently in Manage Variants P&E, it is possible to obtain incorrect values.

This is caused because ManageVariantsDS is not thread safe: it is used as singleton but it has state variables that can be messed up by different threads.
It is quite random and hard to reproduce in real instance so apply attached diff to emulate slower processing.

1. Create a generic product (p) with some variants and execute the "Create Variants" process
2. Open 2 sessions (a and b) and select in both of them that product -> note the products that appear there are p1, p2, p3...
3. In session a filter by search key 1
4. Immediately (less than 2 secs) filter in session b by search key 2
  --> ERROR: note that the response for session a, includes p2 but not p1 as it should be
multiThread
related to defect 0034405pi closed NaroaIriarte 'Manage Variants' process returns no items to show when filtering 
blocks design defect 0034664 acknowledged Triage Platform Base multi thread unsafeties 
png Selection_229.png (32,581) 2017-11-10 10:08
https://issues.openbravo.com/file_download.php?file_id=11278&type=bug
png

diff slow-variants-ds.diff (721) 2017-11-10 10:08
https://issues.openbravo.com/file_download.php?file_id=11279&type=bug
diff slow-variant-fixed.diff (794) 2017-11-11 01:55
https://issues.openbravo.com/file_download.php?file_id=11281&type=bug
Issue History
2016-11-25 09:04alostaleNew Issue
2016-11-25 09:04alostaleAssigned To => Triage Finance
2016-11-25 09:04alostaleModules => Core
2016-11-25 09:04alostaleTriggers an Emergency Pack => No
2016-11-25 09:04alostaleTag Attached: multiThread
2016-11-25 09:05alostaleIssue Monitored: alostale
2016-11-25 09:05alostaleRelationship addedrelated to 0034405
2016-12-01 11:56alostaleRelationship addedblocks 0034664
2017-11-08 16:55collazoandy4Assigned ToTriage Finance => collazoandy4
2017-11-08 16:55collazoandy4Statusnew => scheduled
2017-11-10 10:08alostaleFile Added: Selection_229.png
2017-11-10 10:08alostaleFile Added: slow-variants-ds.diff
2017-11-11 01:55collazoandy4File Added: slow-variant-fixed.diff
2017-11-11 01:55collazoandy4Note Added: 0100457
2018-01-08 09:36hgbotCheckin
2018-01-08 09:36hgbotNote Added: 0101607
2018-01-08 09:36hgbotStatusscheduled => resolved
2018-01-08 09:36hgbotResolutionopen => fixed
2018-01-08 09:36hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/da1ddbd843879beb28c8751006ebd728f9cc3de9 [^]
2018-01-08 09:36hgbotCheckin
2018-01-08 09:36hgbotNote Added: 0101608
2018-01-08 09:38dmiguelezReview Assigned To => dmiguelez
2018-01-08 09:38dmiguelezNote Added: 0101611
2018-01-08 09:38dmiguelezStatusresolved => closed
2018-01-08 09:38dmiguelezFixed in Version => 3.0PR18Q2
2018-02-22 18:18hudsonbotCheckin
2018-02-22 18:18hudsonbotNote Added: 0102644
2018-02-22 18:18hudsonbotCheckin
2018-02-22 18:18hudsonbotNote Added: 0102645

Notes
(0100457)
collazoandy4   
2017-11-11 01:55   
Test Plan
  With the slow-variant-fixed.diff applied create a generic product and add 3 or more characteristic and clic on create variants button
  Open 2 sessions (a and b) and select in both of them that product
  In session a filter by search key 1
  Immediately (less than 2 secs) filter in session b by search key 2 and check the filter data is correct in every session
(0101607)
hgbot   
2018-01-08 09:36   
Repository: erp/devel/pi
Changeset: da1ddbd843879beb28c8751006ebd728f9cc3de9
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Jan 04 12:50:12 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/da1ddbd843879beb28c8751006ebd728f9cc3de9 [^]

Fixes issue 34628: Manage variants can return unexpected values

When filtering concurrently in Manage Variants P&E, it was possible to obtain
incorrect values. This is caused because ManageVariantsDS is not thread safe it
is used as singleton but it has state variables that can be messed up by
different threads.

The global state variables has been removed and now their values are contained
in a new private class. A new instance of this class is created for every execution
of the process, so the values are not mixed again.

The getData and readCriteria methods have been modified to make use of this new
class.

---
M src/org/openbravo/materialmgmt/ManageVariantsDS.java
---
(0101608)
hgbot   
2018-01-08 09:36   
Repository: erp/devel/pi
Changeset: add922deb5848f23f3ec6b7e6cd6c8a8a69494d3
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Thu Jan 04 12:54:31 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/add922deb5848f23f3ec6b7e6cd6c8a8a69494d3 [^]

Related to Issue 34628. Updated license year

---
M src/org/openbravo/materialmgmt/ManageVariantsDS.java
---
(0101611)
dmiguelez   
2018-01-08 09:38   
Code Review + Testing Ok
(0102644)
hudsonbot   
2018-02-22 18: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/980a6ad5bbf5 [^]
Maturity status: Test
(0102645)
hudsonbot   
2018-02-22 18: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/980a6ad5bbf5 [^]
Maturity status: Test