GEODE-8553: Fix inter-locks in ThinClientLocator (#660)

 - ThinClientLocatorHelper uses a mutex called m_locatorLock, which is
   used in the entire scope of all the public member functions for this
   class.
 - Problem with that is all of those functions perform some network
   communication and in the event of networking issues, this will result
   in having all the application threads inter-locked.
 - Also, the only purpose of this mutex is to avoid that the locators
   list is read while it's being updated.
 - Given all of the above, the class has been refactored, so every time
   the locators list has to be accessed, a copy of it is created, being
   that copy created only while owning the mutex.
 - And for the case of the update, a new locators list is composed and
   its only at the end of the update function where the mutex is locked
   and the locators list swapped by the new one.
 - This whole change ensures that the time the mutex is in use is
   minimal while the functionality remains intact.
 - Refactored ConnectionWrapper so is move constructible.
 - Locators list is now initialized using iterator range constructor.
 - Added getConnRetries utility function.
 - Changed mutex for a shared mutex.
 - getLocators function now returns a shuffled list each time.
 - Cleaned-up repeated code. As a result of this createConnection has been
   refactored and a new function called sendRequest has been created.
 - Implemented proposal for locator connections retries, treating the locators
   list as a circular buffer.
 - Added new integration test to verify that threads don't inter-lock anymore.
 - The test works as follow:
   * Set 5s connect-timeout.
   * Deploy 1 locator.
   * Add 1 non-existent locator to the pool.
   * Send 64 concurrent requests to get the server list.
   * By probability if there are no interlocks ~50%+-E% of the requests should
     have completed in a brief period of time.
   * Note that E% is the error allowance percentage, which is set to 10%.
   * Therefore a 10 seconds timeout is set in order to reach the request
     completed treshold.
   * Test passes if the number of completed requests before the timeout was
     greater or equal to the thresholds, otherwise it fails.
5 files changed
tree: 94950a2ac83d09a5c5cc5acbaf0c975c1080d95c
  1. bin/
  2. clicache/
  3. cmake/
  4. cppcache/
  5. defaultSystem/
  6. dependencies/
  7. dist/
  8. docker/
  9. docs/
  10. etc/
  11. examples/
  12. executables/
  13. packer/
  14. sni-test-config/
  15. sqliteimpl/
  16. ssl_keys/
  17. templates/
  18. tests/
  19. tools/
  20. xsds/
  21. .asf.yaml
  22. .clang-format
  23. .clang-tidy
  24. .cpackignore
  25. .gitignore
  26. .lcovrc
  27. .lgtm.yml
  28. .ratignore
  29. .travis.yml
  30. BUILDING.md
  31. CMakeLists.txt
  32. CONTRIBUTING.md
  33. FindNativeClient.cmake
  34. FindNativeClientCPPCache.cmake
  35. LICENSE
  36. NOTICE
  37. README.md
README.md

Build Status License Total alerts Language grade: C/C++ Language grade: C# Language grade: JavaScript

Overview
Building from Source
Application Development

Overview

Native Client is a client implementation for Apache Geode that does not require the Java server JARs.

Building from Source

Directions to build Native Client from source can be found in the source distribution in BUILDING.md.

Application Development

Native Client applications can be written in these client technologies:

Export Control

This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted. See http://www.wassenaar.org/ for more information.

The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms. The form and manner of this Apache Software Foundation distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.

The following provides more details on the included cryptographic software:

  • Apache Geode links to and uses OpenSSL ciphers.