[ https://issues.apache.org/jira/browse/GEODE-8063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17102854#comment-17102854 ]
ASF GitHub Bot commented on GEODE-8063: --------------------------------------- pivotal-jbarrett commented on a change in pull request #597: URL: https://github.com/apache/geode-native/pull/597#discussion_r422321681 ########## File path: cppcache/src/CacheImpl.cpp ########## @@ -640,13 +640,16 @@ void CacheImpl::readyForEvents() { } } -bool CacheImpl::isPoolInMultiuserMode(std::shared_ptr<Region> regionPtr) { - const auto& poolName = regionPtr->getAttributes().getPoolName(); +bool CacheImpl::isPoolInMultiuserMode(std::shared_ptr<Region> region) { + const auto& poolName = region->getAttributes().getPoolName(); if (!poolName.empty()) { - auto poolPtr = regionPtr->getCache().getPoolManager().find(poolName); - if (poolPtr != nullptr && !poolPtr->isDestroyed()) { - return poolPtr->getMultiuserAuthentication(); + auto pool = static_cast<RegionInternal&>(*region) + .getCacheImpl() + ->getPoolManager() + .find(poolName); + if (pool && !pool->isDestroyed()) { + return pool->getMultiuserAuthentication(); Review comment: It's a really good question. I suppose it could use `this` and some that the `region` is owned by `this` `CacheImpl`. Even better refactor. Testing this would require a concurrency test framework we don't have and then magical timing. You could write a flaky test that tries over and over in hopes of hitting it but not hitting it doesn't prove it is fixed. Through analysis of the object lifecycle we can at least guarantee that if we get into this call that `this` `CacheImpl` has not been destructed. ---------------------------------------------------------------- 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 > Access violation during Cache destrucition caused by ClientMetadataService > -------------------------------------------------------------------------- > > Key: GEODE-8063 > URL: https://issues.apache.org/jira/browse/GEODE-8063 > Project: Geode > Issue Type: Bug > Components: native client > Reporter: Jacob Barrett > Assignee: Jacob Barrett > Priority: Major > > During the destruction of {{Cache}} the pointer to {{CacheImpl}} is invalid. > Calls from {{ClientMetadataService}} attempt to access {{Pool}} instances > through the {{Cache}} instance rather than {{CacheImpl}} resulting in access > violation. This issue is timing dependent and isn't always reproducible. -- This message was sent by Atlassian Jira (v8.3.4#803005)