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

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

alb3rtobr commented on a change in pull request #635:
URL: https://github.com/apache/geode-native/pull/635#discussion_r473716608



##########
File path: cppcache/src/PdxTypeRegistry.cpp
##########
@@ -89,8 +89,8 @@ int32_t 
PdxTypeRegistry::getPDXIdForType(std::shared_ptr<PdxType> nType,
     typeId = cache_->getSerializationRegistry()->GetPDXIdForType(pool, nType);
     nType->setTypeId(typeId);
     pdxTypeToTypeIdMap_.insert(std::make_pair(nType, typeId));
+    typeIdToPdxType_.insert(std::make_pair(typeId, nType));
   }
-  addPdxType(typeId, nType);

Review comment:
       `PdxTypeRegistry::addPdxType()` is used several times in `PdxHelper` 
class, it cannot be removed. It is also used other time in `PdxTypeRegistry` 
class, and I think it has sense to keep it for readability: it cannot be 
replace just by a `typeIdToPdxType_.emplace()` call because it is also needed 
to acquire the lock, which is done inside `addPdxType()`




----------------------------------------------------------------
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:
[email protected]


> Several threads calling PdxInstanceFactory::create() causes seg fault
> ---------------------------------------------------------------------
>
>                 Key: GEODE-8436
>                 URL: https://issues.apache.org/jira/browse/GEODE-8436
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Alberto Bustamante Reyes
>            Assignee: Alberto Bustamante Reyes
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: main.cpp
>
>
> I have seen a problem when "PdxInstanceFactory::create()" is called by 
> several threads that are registering the same new pdx type.
> The core is produced here:
> {code}
> void PdxInstanceImpl::toDataMutable(PdxWriter& writer) {
>    auto pt = getPdxType();
>    std::vector<std::shared_ptr<PdxFieldType>>* pdxFieldList =
>        pt->getPdxFieldTypes();
> {code}
> The problem is that "getPdxType()" returns nullptr, so in the next line, 
> there is segmentation fault when calling "pt->getPdxFieldTypes()".
> The issue can be reproduced using the attached client, and executing it using 
> 8 threads. This is the stack got in gdb:
> {code}
> #0  apache::geode::client::PdxType::getPdxFieldTypes (this=0x0) at 
> /home/alb3rtobr/CLionProjects/Nordix/geode-native/cppcache/src/PdxType.hpp:178
> #1  0x00007f43dc4651b7 in 
> apache::geode::client::PdxInstanceImpl::toDataMutable (this=0x7f43c0001600, 
> writer=...) at 
> /home/alb3rtobr/CLionProjects/Nordix/geode-native/cppcache/src/PdxInstanceImpl.cpp:1336
> #2  0x00007f43dc4650fd in apache::geode::client::PdxInstanceImpl::toData 
> (this=0x7f43c0001600, writer=...) at 
> /home/alb3rtobr/CLionProjects/Nordix/geode-native/cppcache/src/PdxInstanceImpl.cpp:1327
> #3  0x00007f43dc444971 in apache::geode::client::PdxHelper::serializePdx 
> (output=..., pdxObject=warning: RTTI symbol not found for class 
> 'std::_Sp_counted_ptr_inplace<apache::geode::client::PdxInstanceImpl, 
> std::allocator<apache::geode::client::PdxInstanceImpl>, 
> (__gnu_cxx::_Lock_policy)2>'
> warning: RTTI symbol not found for class 
> 'std::_Sp_counted_ptr_inplace<apache::geode::client::PdxInstanceImpl, 
> std::allocator<apache::geode::client::PdxInstanceImpl>, 
> (__gnu_cxx::_Lock_policy)2>'
> std::shared_ptr<apache::geode::client::PdxSerializable> (use count 3, weak 
> count 0) = {...})
>     at 
> /home/alb3rtobr/CLionProjects/Nordix/geode-native/cppcache/src/PdxHelper.cpp:77
> #4  0x00007f43dc44b4bc in apache::geode::client::PdxInstanceFactory::create 
> (this=0x7f43c7ffecc8) at 
> /home/alb3rtobr/CLionProjects/Nordix/geode-native/cppcache/src/PdxInstanceFactory.cpp:53
> #5  0x000000000040de2f in doPut () at 
> /home/alb3rtobr/CLionProjects/dummy-client/main.cpp:60
> #6  0x0000000000427767 in std::__invoke_impl<void, void (*)()> 
> (__f=@0x2561aa8: 0x40d860 <doPut()>) at 
> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:60
> #7  0x00000000004276fd in std::__invoke<void (*)()> (__fn=@0x2561aa8: 
> 0x40d860 <doPut()>) at 
> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:95
> #8  0x00000000004276d5 in std::thread::_Invoker<std::tuple<void (*)()> 
> >::_M_invoke<0ul> (this=0x2561aa8) at 
> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/thread:234
> #9  0x00000000004276a5 in std::thread::_Invoker<std::tuple<void (*)()> 
> >::operator() (this=0x2561aa8) at 
> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/thread:243
> #10 0x0000000000427589 in 
> std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > 
> >::_M_run (this=0x2561aa0)
> {code}



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

Reply via email to