[ 
https://issues.apache.org/jira/browse/GEODE-8531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17209744#comment-17209744
 ] 

ASF GitHub Bot commented on GEODE-8531:
---------------------------------------

gaussianrecurrence commented on a change in pull request #667:
URL: https://github.com/apache/geode-native/pull/667#discussion_r501209399



##########
File path: cppcache/integration/test/RegisterKeysTest.cpp
##########
@@ -112,6 +114,51 @@ TEST(RegisterKeysTest, RegisterAllWithCachingRegion) {
   }
 }
 
+TEST(RegisterKeysTest, RegisterAllWithConsistencyDisabled) {
+  Cluster cluster{LocatorCount{1}, ServerCount{1}};
+
+  cluster.start();
+
+  cluster.getGfsh()
+      .create()
+      .region()
+      .withName("region")
+      .withType("PARTITION")
+      .execute();
+
+  auto producer_cache = createTestCache();
+  auto listener_cache = createTestCache();
+
+  auto producer_region = [&cluster](Cache& cache) {
+    auto poolFactory = cache.getPoolManager().createFactory();
+    cluster.applyLocators(poolFactory);
+    poolFactory.create("default");
+    return setupProxyRegion(cache);
+  }(producer_cache);
+
+  auto listener_region = [&cluster](Cache& cache) {
+    auto poolFactory =
+        cache.getPoolManager().createFactory().setSubscriptionEnabled(true);
+    cluster.applyLocators(poolFactory);
+    poolFactory.create("default");
+    auto region = setupCachingProxyRegion(cache, false);
+    region->registerAllKeys();
+    return region;
+  }(listener_cache);
+
+  ASSERT_FALSE(listener_region->containsValueForKey("one"));
+
+  producer_region->put("one", std::make_shared<CacheableInt16>(1));
+  std::this_thread::sleep_for(std::chrono::seconds(5));
+
+  ASSERT_TRUE(listener_region->containsValueForKey("one"));
+
+  producer_region->destroy("one");
+  std::this_thread::sleep_for(std::chrono::seconds(5));

Review comment:
       Oh I see the problem. You see, using the client without region 
consistency is seriously broken because I've seen several coredumps for the 
following scenarios:
   
   1. Putting a key into a region using the NC.
   2. Destroying a key into a region using the NC.
   3. Receiving a LOCAL_DESTROY notification in the NC.
   
   The fix for the coredump in this PR is the one for the third case, so that's 
why I wanted to do it by using notifications. Thing is I was not aware that 
containsValueForKey queries the server. Therefore what about setting up a 
cachelistener for the 'listener_region' which actually is a Google Mock and 
make a call expectation on the afterDestroy function of the catch listener 
using an approach similar to this: 
https://stackoverflow.com/questions/10767131/expecting-googlemock-calls-from-another-thread?
   
   The test flow would be:
   
   1. Setup producer_region without cache and subscription to notifications.
   2. Setup listener_region with cache, subscription notifications and a cache 
listener which actually is a google mock.
   3. Call registerAllKeys on listener_region.
   4. Setup an EXPECT_CALL for the cache listener afterDestroy method, 
specifying the sync barrier action to occur upon call.
   5. Make a put in producer_region
   6. Make a destroy on key same key that on step 5 for producer region.
   7. Wait for (1, 2 or 5 seconds?) for the semaphore.
   
   The test passes only if wait in the last step does not time out. What do you 
think?
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Coredump when removing an entry
> -------------------------------
>
>                 Key: GEODE-8531
>                 URL: https://issues.apache.org/jira/browse/GEODE-8531
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Mario Salazar de Torres
>            Assignee: Mario Salazar de Torres
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: notifications-no-massif.log
>
>
> The scenario is the following:
> *HAVING* a configured concurrency-checks-enabled=false in the 
> client-cache.xml for a region
> *HAVING* a configured subscription-notification for the pool on which the 
> region is defined
> *HAVING* regsitered interest on all the keys of this region, values included
> *WHEN* a LOCAL_DESTROY notification arrives and therefore 
> {color:#4c9aff}MapSegment::remove{color}{color:#172b4d} is called{color}
> {color:#172b4d}*THEN* the application crashes, claiming that the variable 
> entry is a nullptr.{color}
>  
> This is the segmentation report:
> {code:java}
> [debug 2020/09/24 17:21:07.263036 CEST DESKTOP-3SQUK3P:586546 
> 140013383710464] Region::destroy: region [/region] destroying key 
> [entry-152150]
> Segmentation fault
> *** Segmentation fault
> Register dump: RAX: 0000000000000000   RBX: 0000000000000000   RCX: 
> 0000000000000000
>  RDX: 0000000000000000   RSI: 00007f57580008e0   RDI: 00007f5767ffe670
>  RBP: 00007f5767ffe6c0   R8 : 00007f5758000d70   R9 : 0000563da49f0ac0
>  R10: 000000000000000c   R11: 00007f57815a2058   R12: 0000563da6971a48
>  R13: 0000563da696dbd0   R14: 0000000000000000   R15: 00007ffd06db85a0
>  RSP: 00007f5767ffe610 RIP: 00007f578159ac47   EFLAGS: 00010202 CS: 0033   
> FS: 0000   GS: 0000 Trap: 0000000e   Error: 00000004   OldMask: 00000000   
> CR2: 00000000 FPUCW: 0000037f   FPUSW: 00000000   TAG: 00007f57
>  RIP: 80b37f70   RDP: 00000000 ST(0) 0000 0000000000000000   ST(1) 0000 
> 0000000000000000
>  ST(2) 0000 0000000000000000   ST(3) 0000 0000000000000000
>  ST(4) 0000 0000000000000000   ST(5) ffff c000000000000000
>  ST(6) ffff c000000000000000   ST(7) e000 e000000000000000
>  mxcsr: 1f80
>  XMM0:  00000000000000000000000025252525 XMM1:  
> 00000000000000000000000025252525
>  XMM2:  00000000000000000000000025252525 XMM3:  
> 00000000000000000000000025252525
>  XMM4:  00000000000000000000000025252525 XMM5:  
> 00000000000000000000000025252525
>  XMM6:  00000000000000000000000025252525 XMM7:  
> 00000000000000000000000025252525
>  XMM8:  00000000000000000000000025252525 XMM9:  
> 00000000000000000000000025252525
>  XMM10: 00000000000000000000000025252525 XMM11: 
> 00000000000000000000000025252525
>  XMM12: 00000000000000000000000025252525 XMM13: 
> 00000000000000000000000025252525
>  XMM14: 00000000000000000000000025252525 XMM15: 
> 00000000000000000000000025252525Backtrace:
> /usr/local/lib/libapache-geode.so(_ZN6apache5geode6client10MapSegment6removeERKSt10shared_ptrINS1_12CacheableKeyEERS3_INS1_12SerializableEERS3_INS1_12MapEntryImplEEiS3_INS1_10VersionTagEEbRb+0x287)[0x7f578159ac47]
> /usr/local/lib/libapache-geode.so(_ZN6apache5geode6client20ConcurrentEntriesMap6removeERKSt10shared_ptrINS1_12CacheableKeyEERS3_INS1_12SerializableEERS3_INS1_12MapEntryImplEEiS3_INS1_10VersionTagEEb+0xa0)[0x7f57814e1782]
> /usr/local/lib/libapache-geode.so(+0x77173d)[0x7f578157673d]
> /usr/local/lib/libapache-geode.so(_ZN6apache5geode6client11LocalRegion13updateNoThrowINS1_14DestroyActionsEEE9GfErrTypeRKSt10shared_ptrINS1_12CacheableKeyEERKS6_INS1_12SerializableEESE_RSC_iNS1_15CacheEventFlagsES6_INS1_10VersionTagEEPNS1_9DataInputES6_INS1_7EventIdEE+0x515)[0x7f578157af2b]
> /usr/local/lib/libapache-geode.so(_ZN6apache5geode6client11LocalRegion14destroyNoThrowERKSt10shared_ptrINS1_12CacheableKeyEERKS3_INS1_12SerializableEEiNS1_15CacheEventFlagsES3_INS1_10VersionTagEE+0xae)[0x7f578156cf9a]
> /usr/local/lib/libapache-geode.so(_ZN6apache5geode6client16ThinClientRegion25clientNotificationHandlerERNS1_10TcrMessageE+0x1dd)[0x7f57816e13bf]
> /usr/local/lib/libapache-geode.so(_ZN6apache5geode6client16ThinClientRegion19receiveNotificationEPNS1_10TcrMessageE+0x124)[0x7f57816e1fd4]
> /usr/local/lib/libapache-geode.so(+0x86dbc2)[0x7f5781672bc2]
> /usr/local/lib/libapache-geode.so(+0x871aec)[0x7f5781676aec]
> /usr/local/lib/libapache-geode.so(+0x8726a4)[0x7f57816776a4]
> /usr/local/lib/libapache-geode.so(+0x871bba)[0x7f5781676bba]
> /usr/local/lib/libapache-geode.so(+0x873683)[0x7f5781678683]
> /usr/local/lib/libapache-geode.so(+0x873624)[0x7f5781678624]
> /usr/local/lib/libapache-geode.so(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJMN6apache5geode6client4TaskINS5_11TcrEndpointEEEFvvEPS8_EEEEE6_M_runEv+0x1c)[0x7f57816785f4]
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xbd6df)[0x7f5780b396df]
> /lib/x86_64-linux-gnu/libpthread.so.0(+0x76db)[0x7f577f8ff6db]
> /lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7f5780594a3f]Memory 
> map:563da477d000-563da47ef000 r-xp 00000000 08:10 646577 
> /home/earmsla/Repositories/geode-native/examples/cpp/notifications/cmake-build-debug/notifications
> 563da49ee000-563da49f1000 r--p 00071000 08:10 646577 
> /home/earmsla/Repositories/geode-native/examples/cpp/notifications/cmake-build-debug/notifications
> 563da49f1000-563da49f2000 rw-p 00074000 08:10 646577 
> /home/earmsla/Repositories/geode-native/examples/cpp/notifications/cmake-build-debug/notifications
> 563da6930000-563da6994000 rw-p 00000000 00:00 0 [heap]
> 7f5758000000-7f5758021000 rw-p 00000000 00:00 0
> 7f5758021000-7f575c000000 ---p 00000000 00:00 0
> 7f575c000000-7f575c021000 rw-p 00000000 00:00 0
> 7f575c021000-7f5760000000 ---p 00000000 00:00 0
> 7f5760000000-7f5760021000 rw-p 00000000 00:00 0
> 7f5760021000-7f5764000000 ---p 00000000 00:00 0
> 7f57667fd000-7f57667fe000 ---p 00000000 00:00 0
> 7f57667fe000-7f5766ffe000 rw-p 00000000 00:00 0
> 7f5766ffe000-7f5766fff000 ---p 00000000 00:00 0
> 7f5766fff000-7f57677ff000 rw-p 00000000 00:00 0
> 7f57677ff000-7f5767800000 ---p 00000000 00:00 0
> 7f5767800000-7f5768000000 rw-p 00000000 00:00 0
> 7f5768000000-7f5768021000 rw-p 00000000 00:00 0
> 7f5768021000-7f576c000000 ---p 00000000 00:00 0
> 7f576c000000-7f576c021000 rw-p 00000000 00:00 0
> 7f576c021000-7f5770000000 ---p 00000000 00:00 0
> 7f5770000000-7f5770021000 rw-p 00000000 00:00 0
> 7f5770021000-7f5774000000 ---p 00000000 00:00 0
> 7f5774711000-7f5774728000 r-xp 00000000 08:10 61770 
> /lib/x86_64-linux-gnu/libresolv-2.27.so
> 7f5774728000-7f5774928000 ---p 00017000 08:10 61770 
> /lib/x86_64-linux-gnu/libresolv-2.27.so
> 7f5774928000-7f5774929000 r--p 00017000 08:10 61770 
> /lib/x86_64-linux-gnu/libresolv-2.27.so
> 7f5774929000-7f577492a000 rw-p 00018000 08:10 61770 
> /lib/x86_64-linux-gnu/libresolv-2.27.so
> 7f577492a000-7f577492c000 rw-p 00000000 00:00 0
> 7f577492c000-7f5774931000 r-xp 00000000 08:10 23113 
> /lib/x86_64-linux-gnu/libnss_dns-2.27.so
> 7f5774931000-7f5774b31000 ---p 00005000 08:10 23113 
> /lib/x86_64-linux-gnu/libnss_dns-2.27.so
> 7f5774b31000-7f5774b32000 r--p 00005000 08:10 23113 
> /lib/x86_64-linux-gnu/libnss_dns-2.27.so
> 7f5774b32000-7f5774b33000 rw-p 00006000 08:10 23113 
> /lib/x86_64-linux-gnu/libnss_dns-2.27.so
> 7f5774b33000-7f5774b34000 ---p 00000000 00:00 0
> 7f5774b34000-7f5775334000 rw-p 00000000 00:00 0
> 7f5775334000-7f5775335000 ---p 00000000 00:00 0
> 7f5775335000-7f5775b35000 rw-p 00000000 00:00 0
> 7f5775b35000-7f5775b36000 ---p 00000000 00:00 0
> 7f5775b36000-7f5776336000 rw-p 00000000 00:00 0
> 7f5776336000-7f5776337000 ---p 00000000 00:00 0
> 7f5776337000-7f5776b37000 rw-p 00000000 00:00 0
> 7f5776b37000-7f5776b42000 r-xp 00000000 08:10 23541 
> /lib/x86_64-linux-gnu/libnss_files-2.27.so
> 7f5776b42000-7f5776d41000 ---p 0000b000 08:10 23541 
> /lib/x86_64-linux-gnu/libnss_files-2.27.so
> 7f5776d41000-7f5776d42000 r--p 0000a000 08:10 23541 
> /lib/x86_64-linux-gnu/libnss_files-2.27.so
> 7f5776d42000-7f5776d43000 rw-p 0000b000 08:10 23541 
> /lib/x86_64-linux-gnu/libnss_files-2.27.so
> 7f5776d43000-7f5776d49000 rw-p 00000000 00:00 0
> 7f5776d49000-7f5776d4a000 ---p 00000000 00:00 0
> 7f5776d4a000-7f577754a000 rw-p 00000000 00:00 0
> 7f577754a000-7f577754b000 ---p 00000000 00:00 0
> 7f577754b000-7f5777d4b000 rw-p 00000000 00:00 0
> 7f5777d4b000-7f5777d4c000 ---p 00000000 00:00 0
> 7f5777d4c000-7f577854c000 rw-p 00000000 00:00 0
> 7f577854c000-7f577854d000 ---p 00000000 00:00 0
> 7f577854d000-7f5778d4d000 rw-p 00000000 00:00 0
> 7f5778d4d000-7f5778d4e000 ---p 00000000 00:00 0
> 7f5778d4e000-7f577954e000 rw-p 00000000 00:00 0
> 7f577954e000-7f577954f000 ---p 00000000 00:00 0
> 7f577954f000-7f5779d4f000 rw-p 00000000 00:00 0
> 7f5779d4f000-7f5779d50000 ---p 00000000 00:00 0
> 7f5779d50000-7f577a550000 rw-p 00000000 00:00 0
> 7f577a550000-7f577a551000 ---p 00000000 00:00 0
> 7f577a551000-7f577ad51000 rw-p 00000000 00:00 0
> 7f577ad51000-7f577ad52000 ---p 00000000 00:00 0
> 7f577ad52000-7f577b552000 rw-p 00000000 00:00 0
> 7f577b552000-7f577b553000 ---p 00000000 00:00 0
> 7f577b553000-7f577bd53000 rw-p 00000000 00:00 0
> 7f577bd53000-7f577bd54000 ---p 00000000 00:00 0
> 7f577bd54000-7f577c554000 rw-p 00000000 00:00 0
> 7f577c554000-7f577c555000 ---p 00000000 00:00 0
> 7f577c555000-7f577cd55000 rw-p 00000000 00:00 0
> 7f577cd55000-7f577cd56000 ---p 00000000 00:00 0
> 7f577cd56000-7f577d556000 rw-p 00000000 00:00 0
> 7f577d556000-7f577d557000 ---p 00000000 00:00 0
> 7f577d557000-7f577dd57000 rw-p 00000000 00:00 0
> 7f577dd57000-7f577dd58000 ---p 00000000 00:00 0
> 7f577dd58000-7f577e558000 rw-p 00000000 00:00 0
> 7f577e558000-7f577e559000 ---p 00000000 00:00 0
> 7f577e559000-7f577ed59000 rw-p 00000000 00:00 0
> 7f577ed59000-7f577ed5a000 ---p 00000000 00:00 0
> 7f577ed5a000-7f577f55a000 rw-p 00000000 00:00 0
> 7f577f55a000-7f577f6f7000 r-xp 00000000 08:10 3090 
> /lib/x86_64-linux-gnu/libm-2.27.so
> 7f577f6f7000-7f577f8f6000 ---p 0019d000 08:10 3090 
> /lib/x86_64-linux-gnu/libm-2.27.so
> 7f577f8f6000-7f577f8f7000 r--p 0019c000 08:10 3090 
> /lib/x86_64-linux-gnu/libm-2.27.so
> 7f577f8f7000-7f577f8f8000 rw-p 0019d000 08:10 3090 
> /lib/x86_64-linux-gnu/libm-2.27.so
> 7f577f8f8000-7f577f912000 r-xp 00000000 08:10 61769 
> /lib/x86_64-linux-gnu/libpthread-2.27.so
> 7f577f912000-7f577fb11000 ---p 0001a000 08:10 61769 
> /lib/x86_64-linux-gnu/libpthread-2.27.so
> 7f577fb11000-7f577fb12000 r--p 00019000 08:10 61769 
> /lib/x86_64-linux-gnu/libpthread-2.27.so
> 7f577fb12000-7f577fb13000 rw-p 0001a000 08:10 61769 
> /lib/x86_64-linux-gnu/libpthread-2.27.so
> 7f577fb13000-7f577fb17000 rw-p 00000000 00:00 0
> 7f577fb17000-7f577fdb2000 r-xp 00000000 08:10 260153 
> /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
> 7f577fdb2000-7f577ffb1000 ---p 0029b000 08:10 260153 
> /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
> 7f577ffb1000-7f577ffdd000 r--p 0029a000 08:10 260153 
> /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
> 7f577ffdd000-7f577ffdf000 rw-p 002c6000 08:10 260153 
> /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
> 7f577ffdf000-7f577ffe2000 rw-p 00000000 00:00 0
> 7f577ffe2000-7f5780062000 r-xp 00000000 08:10 260154 
> /usr/lib/x86_64-linux-gnu/libssl.so.1.1
> 7f5780062000-7f5780262000 ---p 00080000 08:10 260154 
> /usr/lib/x86_64-linux-gnu/libssl.so.1.1
> 7f5780262000-7f578026b000 r--p 00080000 08:10 260154 
> /usr/lib/x86_64-linux-gnu/libssl.so.1.1
> 7f578026b000-7f578026f000 rw-p 00089000 08:10 260154 
> /usr/lib/x86_64-linux-gnu/libssl.so.1.1
> 7f578026f000-7f5780272000 r-xp 00000000 08:10 3089 
> /lib/x86_64-linux-gnu/libdl-2.27.so
> 7f5780272000-7f5780471000 ---p 00003000 08:10 3089 
> /lib/x86_64-linux-gnu/libdl-2.27.so
> 7f5780471000-7f5780472000 r--p 00002000 08:10 3089 
> /lib/x86_64-linux-gnu/libdl-2.27.so
> 7f5780472000-7f5780473000 rw-p 00003000 08:10 3089 
> /lib/x86_64-linux-gnu/libdl-2.27.so
> 7f5780473000-7f578065a000 r-xp 00000000 08:10 3086 
> /lib/x86_64-linux-gnu/libc-2.27.so
> 7f578065a000-7f578085a000 ---p 001e7000 08:10 3086 
> /lib/x86_64-linux-gnu/libc-2.27.so
> 7f578085a000-7f578085e000 r--p 001e7000 08:10 3086 
> /lib/x86_64-linux-gnu/libc-2.27.so
> 7f578085e000-7f5780860000 rw-p 001eb000 08:10 3086 
> /lib/x86_64-linux-gnu/libc-2.27.so
> 7f5780860000-7f5780864000 rw-p 00000000 00:00 0
> 7f5780864000-7f578087b000 r-xp 00000000 08:10 2907 
> /lib/x86_64-linux-gnu/libgcc_s.so.1
> 7f578087b000-7f5780a7a000 ---p 00017000 08:10 2907 
> /lib/x86_64-linux-gnu/libgcc_s.so.1
> 7f5780a7a000-7f5780a7b000 r--p 00016000 08:10 2907 
> /lib/x86_64-linux-gnu/libgcc_s.so.1
> 7f5780a7b000-7f5780a7c000 rw-p 00017000 08:10 2907 
> /lib/x86_64-linux-gnu/libgcc_s.so.1
> 7f5780a7c000-7f5780bf5000 r-xp 00000000 08:10 82591 
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
> 7f5780bf5000-7f5780df5000 ---p 00179000 08:10 82591 
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
> 7f5780df5000-7f5780dff000 r--p 00179000 08:10 82591 
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
> 7f5780dff000-7f5780e01000 rw-p 00183000 08:10 82591 
> /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
> 7f5780e01000-7f5780e05000 rw-p 00000000 00:00 0
> 7f5780e05000-7f5781ce7000 r-xp 00000000 08:10 614023 
> /usr/local/lib/libapache-geode.so
> 7f5781ce7000-7f5781ee6000 ---p 00ee2000 08:10 614023 
> /usr/local/lib/libapache-geode.so
> 7f5781ee6000-7f5781f24000 r--p 00ee1000 08:10 614023 
> /usr/local/lib/libapache-geode.so
> 7f5781f24000-7f5781f74000 rw-p 00f1f000 08:10 614023 
> /usr/local/lib/libapache-geode.so
> 7f5781f74000-7f5781f79000 rw-p 00000000 00:00 0
> 7f5781f79000-7f5781f7d000 r-xp 00000000 08:10 2523 
> /lib/x86_64-linux-gnu/libSegFault.so
> 7f5781f7d000-7f578217c000 ---p 00004000 08:10 2523 
> /lib/x86_64-linux-gnu/libSegFault.so
> 7f578217c000-7f578217d000 r--p 00003000 08:10 2523 
> /lib/x86_64-linux-gnu/libSegFault.so
> 7f578217d000-7f578217e000 rw-p 00004000 08:10 2523 
> /lib/x86_64-linux-gnu/libSegFault.so
> 7f578217e000-7f57821a5000 r-xp 00000000 08:10 2423 
> /lib/x86_64-linux-gnu/ld-2.27.so
> 7f5782380000-7f578238a000 rw-p 00000000 00:00 0
> 7f57823a3000-7f57823a5000 rw-p 00000000 00:00 0
> 7f57823a5000-7f57823a6000 r--p 00027000 08:10 2423 
> /lib/x86_64-linux-gnu/ld-2.27.so
> 7f57823a6000-7f57823a7000 rw-p 00028000 08:10 2423 
> /lib/x86_64-linux-gnu/ld-2.27.so
> 7f57823a7000-7f57823a8000 rw-p 00000000 00:00 0
> 7ffd06d9a000-7ffd06dbb000 rw-p 00000000 00:00 0 [stack]
> 7ffd06dd7000-7ffd06dda000 r--p 00000000 00:00 0 [vvar]
> 7ffd06dda000-7ffd06ddc000 r-xp 00000000 00:00 0 [vdso]
> {code}
> {color:#172b4d} {color}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to