Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0033409 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
design defect | [Retail Modules] StoreServer | minor | have not tried | 2016-07-01 12:25 | 2017-02-07 17:53 | |||
Reporter | mtaal | View Status | public | |||||
Assigned To | AugustoMauch | |||||||
Priority | normal | Resolution | duplicate | Fixed in Version | ||||
Status | closed | Fix in branch | Fixed in SCM revision | |||||
Projection | none | ETA | none | Target Version | ||||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Review Assigned To | ||||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0033409: Prevent race condition & improve initialization code in Mobile Server Key by org/client cache | |||||||
Description | The current code which initializes the cache of mobile server keys by org/client cache has a danger of a race condition as it sets the mobileServersByClient member in the beginning of the initialization code. This means that any next call to getNodeIdsForClient will continue and possibly access a not-yet-initialized mobileServersByClient. https://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/file/5ff67cc8ae3b/src/org/openbravo/replication/symmetricds/util/MobileServerProvider.java#l102 [^] Also it seems that the initialization code of the mobileServersByClient again calls getMobileServersByClient. This is not adviced in these type of initialization code. | |||||||
Steps To Reproduce | See the code | |||||||
Proposed Solution | To initialize a cache in safe way a code structure like this below can be used. private Map<String, String> cache = null; public Map<String, String> getCache() { if (cache == null) { initializeCache(); } return cache; } private synchronized initializeCache() { if (cache != null) { return; } final Map<String, String> localCache = new HashMap...; // initialize the localCache, try not to call to many // other methods, makes it confusing, make sure that any other methods // you use here to initialize do not use/call getCache() // initialization done, set, this is threadsafe cache = localCache; } | |||||||
Tags | No tags attached. | |||||||
Attached Files | ||||||||
Relationships [ Relation Graph ] [ Dependency Graph ] | ||||||||
|
Issue History | |||
Date Modified | Username | Field | Change |
2016-07-01 12:25 | mtaal | New Issue | |
2016-07-01 12:25 | mtaal | Assigned To | => AugustoMauch |
2016-07-11 13:17 | gorka_gil | Project | Modules => Retail Modules |
2016-07-11 13:23 | gorka_gil | Category | StoreServer Configuration => (No Category) |
2016-07-11 13:26 | gorka_gil | Category | (No Category) => StoreServer Configuration |
2016-07-12 16:12 | mtaal | Triggers an Emergency Pack | => No |
2016-07-12 16:12 | mtaal | Category | StoreServer Configuration => StoreServer Infrastructure |
2016-07-12 16:13 | gorka_gil | Category | StoreServer Infrastructure => StoreServer |
2017-02-07 17:53 | AugustoMauch | Relationship added | duplicate of 0034999 |
2017-02-07 17:53 | AugustoMauch | Status | new => closed |
2017-02-07 17:53 | AugustoMauch | Resolution | open => duplicate |
Copyright © 2000 - 2009 MantisBT Group |