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

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

pivotal-jbarrett commented on a change in pull request #169: GEODE-4098, add 
mutex timeout 
URL: https://github.com/apache/geode-native/pull/169#discussion_r158719891
 
 

 ##########
 File path: cppcache/src/ClientMetadataService.cpp
 ##########
 @@ -143,7 +143,13 @@ void ClientMetadataService::getClientPRMetadata(const 
char* regionFullPath) {
                                               reply.getFpaSet());
       if (m_bucketWaitTimeout > std::chrono::milliseconds::zero() &&
           reply.getNumBuckets() > 0) {
-        WriteGuard guard(m_PRbucketStatusLock);
+        std::unique_lock<std::timed_mutex> guard(m_timedBucketStatusLock,
+                                                 CLOSE_SERVICE_MUTEX_TIMEOUT);
+        if (!guard.owns_lock()) {
+          LOGERROR("Buckets statuses container read mutex timeout %lld 
seconds",
 
 Review comment:
   Sorry you were given incorrect advice here. `std::chrono::duration` should 
not be assumed to convert to a `uint64_t`. The internal representation of the 
duration value is system dependent. No explicit conversion is defined in the 
std C++ spec to any primitive integer type. No std C++ method exists for 
duration to string conversions, though a a few custom options exist for 
converting `std::chrono::duration` to a string. I prefer one that uses our 
utility class for converting to a string representation with unit. 
   ```c++
   LOGERROR("Buckets statuses container read mutex timeout %s", 
       util::chrono::duration::to_string(CLOSE_SERVICE_MUTEX_TIMEOUT).c_str());
   ```
   Or using the `std::string` overload of `LOGERROR`:
   ```c++
   LOGERROR("Buckets statuses container read mutex timeout " + 
       util::chrono::duration::to_string(CLOSE_SERVICE_MUTEX_TIMEOUT));
   ```
   You may need to include "util/chrono/duration.hpp".
   
   The above will produce log message like this:
   ```
   Buckets statuses container read mutex timeout 60s.
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Mutex guarding buckets statuses container has no timeout hanldling
> ------------------------------------------------------------------
>
>                 Key: GEODE-4098
>                 URL: https://issues.apache.org/jira/browse/GEODE-4098
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Igor Barchak
>             Fix For: 1.2.0
>
>
> Mutex guarding buckets statuses container has no timeout handling,in 
> ClientMetadataService.cpp
> Can cause messages stuck on client 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to