Repository: hadoop
Updated Branches:
  refs/heads/HDFS-8707 ff2b18c45 -> 7d5fb82ff


HDFS-11436: libhdfs++: Fix race condition in ScopedResolver.  Contributed by 
James Clampffer.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7d5fb82f
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7d5fb82f
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7d5fb82f

Branch: refs/heads/HDFS-8707
Commit: 7d5fb82ffe562b68114e8d089aad09833d6f799a
Parents: ff2b18c
Author: James <[email protected]>
Authored: Wed Feb 22 12:12:24 2017 -0500
Committer: James <[email protected]>
Committed: Wed Feb 22 12:12:24 2017 -0500

----------------------------------------------------------------------
 .../src/main/native/libhdfspp/lib/common/namenode_info.cc       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/7d5fb82f/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/namenode_info.cc
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/namenode_info.cc
 
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/namenode_info.cc
index bd43091..bd3f44f 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/namenode_info.cc
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/namenode_info.cc
@@ -109,13 +109,14 @@ class ScopedResolver {
 
     // Now set up the promise, set it in async_resolve's callback
     result_status_ = std::make_shared<std::promise<Status>>();
+    std::shared_ptr<std::promise<Status>> shared_result = result_status_;
 
     // Callback to pull a copy of endpoints out of resolver and set promise
-    auto callback = [this](const asio::error_code &ec, 
::asio::ip::tcp::resolver::iterator out) {
+    auto callback = [this, shared_result](const asio::error_code &ec, 
::asio::ip::tcp::resolver::iterator out) {
       if(!ec) {
         std::copy(out, ::asio::ip::tcp::resolver::iterator(), 
std::back_inserter(endpoints_));
       }
-      result_status_->set_value( ToStatus(ec) );
+      shared_result->set_value( ToStatus(ec) );
     };
     resolver_.async_resolve(query_, callback);
     return true;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to