This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
commit 21d25d23fc6d0696592668fa56a02a884458982f Author: Andrew Wong <aw...@cloudera.com> AuthorDate: Thu Dec 2 21:32:20 2021 -0800 [ranger] clarify error message from subprocess Often times, we'll see error messages like the following: org.apache.kudu.client.NonRecoverableException: unable to send message: Other end of pipe was closed at org.apache.kudu.client.KuduException.transformException(KuduException.java:110) at org.apache.kudu.client.KuduClient.joinAndHandleException(KuduClient.java:470) at org.apache.kudu.client.KuduClient.openTable(KuduClient.java:288) ... with litle explanation of what pipe was closed, when really, it's always the Ranger subprocess pipe. This patch adds that context so it's clear to users that their pipe-related issues are Ranger client issues. I tested this manually by running a Ranger test, killing the Ranger client subprocess, and witnessing the following Kudu C++ client error message: End of file: Error creating table db.table on the master: Failed to execute Ranger client subprocess request: unable to send message: Other end of pipe was closed Change-Id: I4a0fcd899439a822c6239494fedb0895adc046fd Reviewed-on: http://gerrit.cloudera.org:8080/18067 Reviewed-by: Alexey Serbin <aser...@cloudera.com> Tested-by: Kudu Jenkins --- src/kudu/ranger/ranger_client.cc | 3 ++- src/kudu/subprocess/subprocess_proxy.h | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/kudu/ranger/ranger_client.cc b/src/kudu/ranger/ranger_client.cc index 3d9ffa6..e69ce98 100644 --- a/src/kudu/ranger/ranger_client.cc +++ b/src/kudu/ranger/ranger_client.cc @@ -390,7 +390,8 @@ Status RangerClient::Start() { const string fifo_path = SubprocessServer::FifoPath(RangerFifoBase()); vector<string> argv; RETURN_NOT_OK(BuildArgv(fifo_path, log_properties_path, &argv)); - subprocess_.reset(new RangerSubprocess(env_, fifo_path, std::move(argv), metric_entity_)); + subprocess_.reset(new RangerSubprocess(env_, fifo_path, std::move(argv), metric_entity_, + "Ranger client subprocess")); return subprocess_->Start(); } diff --git a/src/kudu/subprocess/subprocess_proxy.h b/src/kudu/subprocess/subprocess_proxy.h index d5a5d1b..37f6687 100644 --- a/src/kudu/subprocess/subprocess_proxy.h +++ b/src/kudu/subprocess/subprocess_proxy.h @@ -54,8 +54,10 @@ template<class ReqPB, class RespPB, class MetricsPB> class SubprocessProxy { public: SubprocessProxy(Env* env, const std::string& receiver_file, - std::vector<std::string> argv, const scoped_refptr<MetricEntity>& entity) - : server_(new SubprocessServer(env, receiver_file, std::move(argv), MetricsPB(entity))) {} + std::vector<std::string> argv, const scoped_refptr<MetricEntity>& entity, + std::string subprocess_name = "subprocess") + : server_(new SubprocessServer(env, receiver_file, std::move(argv), MetricsPB(entity))), + subprocess_name_(std::move(subprocess_name)) {} // Starts the underlying subprocess. Status Start() { @@ -69,14 +71,17 @@ class SubprocessProxy { SubprocessRequestPB sreq; sreq.mutable_request()->PackFrom(req); SubprocessResponsePB sresp; - RETURN_NOT_OK(server_->Execute(&sreq, &sresp)); + RETURN_NOT_OK_PREPEND(server_->Execute(&sreq, &sresp), + strings::Substitute("Failed to execute $0 request", subprocess_name_)); if (!sresp.response().UnpackTo(resp)) { LOG(ERROR) << strings::Substitute("unable to unpack response: $0", pb_util::SecureDebugString(sresp)); - return Status::Corruption("unable to unpack response"); + return Status::Corruption( + strings::Substitute("unable to unpack $0 response", subprocess_name_)); } if (sresp.has_error()) { - return StatusFromPB(sresp.error()); + return StatusFromPB(sresp.error()).CloneAndPrepend( + strings::Substitute("error in $0 response", subprocess_name_)); } return Status::OK(); } @@ -87,6 +92,7 @@ class SubprocessProxy { } private: std::unique_ptr<SubprocessServer> server_; + const std::string subprocess_name_; }; } // namespace subprocess