Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0039005Openbravo ERPA. Platformpublic2018-07-20 08:132018-08-08 13:06
alostale 
alostale 
urgentmajorrandom
closedfixed 
5
 
3.0PR18Q4 
caristu
Core
No
0039005: BaseComponentProvider is not thread safe
BaseComponentProvider has a field (appDependencies) which is thread unsafe.

This static field is a HashMap which is not thread safe, it is generally initialized by different ComponentProviders in their static initializers for example in MobileCoreComponentProvider:

  static {
    // Set dependency on Mobile Core app
    BaseComponentProvider.setAppDependencies(MobileCoreConstants.RETAIL_CORE,
        Arrays.asList(MobileCoreConstants.APP_IDENTIFIER));
  }


If two different threads execute static initializer of different ComponentProviders concurrently, the contents of this field can be uncertain.
Unclear and random.

It could cause the following problem:

1. In an instance with retail
2. Load login page
  -> ERROR: Nothing is loaded an error page is seen saying "The WebPOS cannot be loaded"

This can occur the first time login page is loaded. If it occurs, WebPOS won't be loadable till Tomcat is restarted, if it does not occur 1st load, subsequent ones will continue working.

See https://ci.openbravo.com/view/try-retail/job/try-ret-test-pgsql-suite8/4853/artifact/SANDBOX/automation/pi-mobile/last-results/try-ret-test-pgsql-suite8/screenshots/15%3A01%3A44%20FAILED%3A%20ATT010_AttributesLayaways.png [^]
Change appDependencies from HashMap to ConcurrentHashMap.
No tags attached.
depends on backport 00390063.0PR18Q3 closed alostale BaseComponentProvider is not thread safe 
depends on backport 00390073.0PR18Q2.2 closed alostale BaseComponentProvider is not thread safe 
blocks design defect 0034664 acknowledged Triage Platform Base multi thread unsafeties 
png pos-loading-error.png (34,316) 2018-07-20 08:15
https://issues.openbravo.com/file_download.php?file_id=11986&type=bug
png
Issue History
2018-07-20 08:13alostaleNew Issue
2018-07-20 08:13alostaleAssigned To => alostale
2018-07-20 08:13alostaleModules => Core
2018-07-20 08:13alostaleTriggers an Emergency Pack => No
2018-07-20 08:13alostaleReview Assigned To => caristu
2018-07-20 08:13alostaleRelationship addedblocks 0034664
2018-07-20 08:15alostaleFile Added: pos-loading-error.png
2018-07-20 08:33alostaleStatusnew => scheduled
2018-07-20 08:34hgbotCheckin
2018-07-20 08:34hgbotNote Added: 0105817
2018-07-20 08:34hgbotCheckin
2018-07-20 08:34hgbotNote Added: 0105818
2018-07-20 08:34hgbotStatusscheduled => resolved
2018-07-20 08:34hgbotResolutionopen => fixed
2018-07-20 08:34hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/abf1220478484730722610844010ccd09671897a [^]
2018-07-24 10:40hgbotCheckin
2018-07-24 10:40hgbotNote Added: 0105852
2018-07-27 10:27caristuNote Added: 0105972
2018-07-27 10:27caristuStatusresolved => closed
2018-07-27 10:27caristuFixed in Version => 3.0PR18Q4
2018-08-08 13:06hudsonbotCheckin
2018-08-08 13:06hudsonbotNote Added: 0106214
2018-08-08 13:06hudsonbotCheckin
2018-08-08 13:06hudsonbotNote Added: 0106215
2018-08-08 13:06hudsonbotCheckin
2018-08-08 13:06hudsonbotNote Added: 0106218

Notes
(0105817)
hgbot   
2018-07-20 08:34   
Repository: erp/devel/pi
Changeset: 7c8fe974bb457fabd559cf90b1a234370f3d40a6
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jul 20 08:28:38 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/7c8fe974bb457fabd559cf90b1a234370f3d40a6 [^]

related to bug 39005: added log

  Added verbose debug log to StaticResourceComponent, to be able to trace issues
  when generating resources.

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/StaticResourceComponent.java
---
(0105818)
hgbot   
2018-07-20 08:34   
Repository: erp/devel/pi
Changeset: abf1220478484730722610844010ccd09671897a
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jul 20 08:30:59 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/abf1220478484730722610844010ccd09671897a [^]

fixed bug 39005: BaseComponentProvider is not thread safe

  Static appDependencies has been changed from HashMap to ConcurrentHashMap,
  this field can potentially be concurrently initialized from several classes
  being HashMap not thread safe can lead to inconsistent results.

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseComponentProvider.java
---
(0105852)
hgbot   
2018-07-24 10:40   
Repository: erp/devel/pi
Changeset: e2c56d84d26d474602c490bef52dc2ffb93cf343
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Tue Jul 24 10:39:37 2018 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/e2c56d84d26d474602c490bef52dc2ffb93cf343 [^]

related to issue 39005: minor code improvements

  - Can directly return the createComponentResource result
  - Use diamond operator

---
M modules/org.openbravo.client.kernel/src/org/openbravo/client/kernel/BaseComponentProvider.java
---
(0105972)
caristu   
2018-07-27 10:27   
Code reviewed
(0106214)
hudsonbot   
2018-08-08 13:06   
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/bfd7a414183a [^]
Maturity status: Test
(0106215)
hudsonbot   
2018-08-08 13:06   
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/bfd7a414183a [^]
Maturity status: Test
(0106218)
hudsonbot   
2018-08-08 13:06   
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/bfd7a414183a [^]
Maturity status: Test