Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033409
TypeCategorySeverityReproducibilityDate SubmittedLast Update
design defect[Retail Modules] StoreServerminorhave not tried2016-07-01 12:252017-02-07 17:53
ReportermtaalView Statuspublic 
Assigned ToAugustoMauch 
PrioritynormalResolutionduplicateFixed in Version
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033409: Prevent race condition & improve initialization code in Mobile Server Key by org/client cache

DescriptionThe 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 ReproduceSee the code
Proposed SolutionTo 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;
}
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
duplicate of feature request 0034999RR17Q2 closedmtaal Do more caching and re-organize code in MobileServerProvider in the Replication Module 

-  Notes
There are no notes attached to this issue.

- 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
Powered by Mantis Bugtracker