Repository: hadoop Updated Branches: refs/heads/trunk c4bbcd563 -> 7969cc466
HDFS-13615. libhdfs++ SaslProtocol hanging while accessing invalid lock. Contributed by Mitchell Tracy Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7969cc46 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7969cc46 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7969cc46 Branch: refs/heads/trunk Commit: 7969cc4667343e5d3d738de66483e63af1955bbc Parents: c4bbcd5 Author: James Clampffer <[email protected]> Authored: Thu Jun 7 16:02:57 2018 -0400 Committer: James Clampffer <[email protected]> Committed: Thu Jun 7 16:02:57 2018 -0400 ---------------------------------------------------------------------- .../main/native/libhdfspp/lib/rpc/sasl_protocol.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/7969cc46/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc index 0957ea3..6fc04f7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/sasl_protocol.cc @@ -91,8 +91,10 @@ void SaslProtocol::Authenticate(std::function<void(const Status & status, const std::shared_ptr<RpcSaslProto> resp_msg = std::make_shared<RpcSaslProto>(); auto self(shared_from_this()); connection->AsyncRpc_locked(SASL_METHOD_NAME, req_msg.get(), resp_msg, - [self, req_msg, resp_msg] (const Status & status) { - self->OnServerResponse(status, resp_msg.get()); } ); + [self, req_msg, resp_msg, connection] (const Status & status) { + assert(connection); + self->OnServerResponse(status, resp_msg.get()); + }); } // authenticate() method AuthInfo::AuthMethod ParseMethod(const std::string & method) @@ -340,9 +342,10 @@ bool SaslProtocol::SendSaslMessage(RpcSaslProto & message) std::shared_ptr<RpcSaslProto> resp_msg = std::make_shared<RpcSaslProto>(); auto self(shared_from_this()); connection->AsyncRpc(SASL_METHOD_NAME, &message, resp_msg, - [self, resp_msg] (const Status & status) { - self->OnServerResponse(status, resp_msg.get()); - } ); + [self, resp_msg, connection] (const Status & status) { + assert(connection); + self->OnServerResponse(status, resp_msg.get()); + }); return true; } // SendSaslMessage() method @@ -370,7 +373,9 @@ bool SaslProtocol::AuthComplete(const Status & status, const AuthInfo & auth_inf void SaslProtocol::OnServerResponse(const Status & status, const hadoop::common::RpcSaslProto * response) { + std::lock_guard<std::mutex> state_lock(sasl_state_lock_); + LOG_TRACE(kRPC, << "Received SASL response: " << status.ToString()); if (status.ok()) { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
