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

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

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



##########
File path: cppcache/integration/test/PdxSerializerTest.cpp
##########
@@ -115,18 +113,19 @@ std::shared_ptr<Region> setupRegion(Cache& cache) {
   return region;
 }
 
-void assertNonPdxType(const std::shared_ptr<NonPdxType>& expected,
-                      const std::shared_ptr<Cacheable>& actual) {
-  ASSERT_NE(nullptr, actual);
-  auto pdxWrapper = std::dynamic_pointer_cast<PdxWrapper>(actual);
-  ASSERT_NE(nullptr, pdxWrapper);
-  auto object = pdxWrapper->getObject();
-  ASSERT_NE(nullptr, object);
+void expectNonPdxTypeEquals(const std::shared_ptr<NonPdxType>& expected,
+                            const std::shared_ptr<Cacheable>& actual) {
+  EXPECT_TRUE(actual);
+
+  auto wrapper = std::dynamic_pointer_cast<PdxWrapper>(actual);
+  EXPECT_TRUE(wrapper);
+
+  auto object = wrapper->getObject();
+  EXPECT_TRUE(object);
+
   auto nonPdxType = std::static_pointer_cast<NonPdxType>(object);
-  ASSERT_NE(nullptr, nonPdxType);
-  EXPECT_EQ(2, nonPdxType->getLongValue());
+  EXPECT_TRUE(nonPdxType);
 
-  EXPECT_NE(expected, nonPdxType);
   EXPECT_EQ(*expected, *nonPdxType);

Review comment:
       That's odd, I've used EXPECT_EQ lots of times with std::string. The way 
EXPECT_EQ internally works is by calling operator== and if the comparison 
fails, then  both objects are serialized and shown the expected and actual in 
the output. Problem is whenever there is no serialization possible for a pair 
of objects you are comparing. In this case you would see an hexdump of the 
objects that can't be serialized.
   
   Serialization btw is done by calling the ostream& operator<<(ostream& os, 
const ClassName& dt), so internally gtest uses SFINAE to check whether there is 
or not an implementation for the specific object being serialized.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org

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


> Fix coredump whenever getFieldNames is called after a cluster restart
> ---------------------------------------------------------------------
>
>                 Key: GEODE-9268
>                 URL: https://issues.apache.org/jira/browse/GEODE-9268
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Mario Salazar de Torres
>            Assignee: Mario Salazar de Torres
>            Priority: Major
>              Labels: pull-request-available
>
> *WHEN* A PdxInstance is fetched from a region
>  *AND* The whole cluster is restarted, triggering PdxTypeRegistry cleanup.
>  *AND* getFieldNames is called on the PdxInstance created just before
>  *THEN* a coredump happens.
> —
> *Additional information:*
> Callstack:
> {noformat}
> [ERROR 2021/05/05 12:57:12.781834 CEST main (139683590957120)] Segmentation 
> fault happened
>  0# handler(int) at nc-pdx/main.cpp:225
>  1# 0x00007F0A9F5F13C0 in /lib/x86_64-linux-gnu/libpthread.so.0
>  2# apache::geode::client::PdxType::getPdxFieldTypes() const at 
> cppcache/src/PdxType.hpp:181
>  3# apache::geode::client::PdxInstanceImpl::getFieldNames() at 
> cppcache/src/PdxInstanceImpl.cpp:1383
>  4# main at nc-pdx/main.cpp:374
>  5# __libc_start_main in /lib/x86_64-linux-gnu/libc.so.6
>  6# _start in build/pdx{noformat}



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

Reply via email to