You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2021/07/10 17:00:52 UTC

[geode-native] branch develop updated: GEODE-8891: Move static regex in ThinClientRegion (#830)

This is an automated email from the ASF dual-hosted git repository.

bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git


The following commit(s) were added to refs/heads/develop by this push:
     new 924c633  GEODE-8891: Move static regex in ThinClientRegion (#830)
924c633 is described below

commit 924c633b732652ba593da690b6e832cb72038f05
Author: Blake Bender <bb...@pivotal.io>
AuthorDate: Sat Jul 10 10:00:45 2021 -0700

    GEODE-8891: Move static regex in ThinClientRegion (#830)
    
    Make static regex a local static variable
    - Latest compiler/runtime on RHEL-8 causes an order-of-initialization bug for this static regex, and will core dump at app startup for optimized builds.
    Changing to local variable ensures regex variable isn't initialized until the first time we use it, long after all static initializers are called.
---
 cppcache/src/ThinClientRegion.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cppcache/src/ThinClientRegion.cpp b/cppcache/src/ThinClientRegion.cpp
index 171e5dc..2d9fb81 100644
--- a/cppcache/src/ThinClientRegion.cpp
+++ b/cppcache/src/ThinClientRegion.cpp
@@ -49,9 +49,6 @@ namespace apache {
 namespace geode {
 namespace client {
 
-static const std::regex PREDICATE_IS_FULL_QUERY_REGEX(
-    "^\\s*(?:select|import)\\b", std::regex::icase);
-
 void setThreadLocalExceptionMessage(std::string exMsg);
 
 class PutAllWork : public PooledWork<GfErrType> {
@@ -588,8 +585,11 @@ std::shared_ptr<SelectResults> ThinClientRegion::query(
     throw IllegalArgumentException("Region query predicate string is empty");
   }
 
+  static const std::regex isFullQueryRegex("^\\s*(?:select|import)\\b",
+                                           std::regex::icase);
+
   std::string squery;
-  if (std::regex_search(predicate, PREDICATE_IS_FULL_QUERY_REGEX)) {
+  if (std::regex_search(predicate, isFullQueryRegex)) {
     squery = predicate;
   } else {
     squery = "select distinct * from ";