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
The following commit(s) were added to refs/heads/master by this push:
new f7c4bbc [util] info on sent/received if Blocking{Recv,Write} timed out
f7c4bbc is described below
commit f7c4bbc84a8afe3ed0d269bb909abe91cfcef6d6
Author: Alexey Serbin <[email protected]>
AuthorDate: Fri Sep 18 17:43:55 2020 -0700
[util] info on sent/received if Blocking{Recv,Write} timed out
This patch adds information on the number of requested and actually
sent/received bytes into the return status of Socket::BlockingRecv()
and Socket::BlockingWrite() methods in case of operation times out.
The motivation for this patch is to help in troubleshooting of
connection negotiation issues.
Change-Id: I5d0b910a93d8b3c8c4b387f73c19207021d56574
Reviewed-on: http://gerrit.cloudera.org:8080/16475
Tested-by: Kudu Jenkins
Reviewed-by: Grant Henke <[email protected]>
---
src/kudu/util/net/socket.cc | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/kudu/util/net/socket.cc b/src/kudu/util/net/socket.cc
index 26a8ccc..4274296 100644
--- a/src/kudu/util/net/socket.cc
+++ b/src/kudu/util/net/socket.cc
@@ -466,7 +466,8 @@ Status Socket::BlockingWrite(const uint8_t *buf, size_t
buflen, size_t *nwritten
int32_t num_to_write = buflen - tot_written;
MonoDelta timeout = deadline - MonoTime::Now();
if (PREDICT_FALSE(timeout.ToNanoseconds() <= 0)) {
- return Status::TimedOut("BlockingWrite timed out");
+ return Status::TimedOut(Substitute("sent $0 of $1 requested bytes",
+ tot_written, buflen));
}
RETURN_NOT_OK(SetSendTimeout(timeout));
Status s = Write(buf, num_to_write, &inc_num_written);
@@ -480,7 +481,8 @@ Status Socket::BlockingWrite(const uint8_t *buf, size_t
buflen, size_t *nwritten
continue;
}
if (s.posix_code() == EAGAIN) {
- return Status::TimedOut("");
+ return Status::TimedOut(Substitute("sent $0 of $1 requested bytes",
+ tot_written, buflen));
}
return s.CloneAndPrepend("BlockingWrite error");
}
@@ -542,7 +544,8 @@ Status Socket::BlockingRecv(uint8_t *buf, size_t amt,
size_t *nread, const MonoT
int32_t num_to_read = amt - tot_read;
MonoDelta timeout = deadline - MonoTime::Now();
if (PREDICT_FALSE(timeout.ToNanoseconds() <= 0)) {
- return Status::TimedOut("");
+ return Status::TimedOut(Substitute("received $0 of $1 requested bytes",
+ tot_read, amt));
}
RETURN_NOT_OK(SetRecvTimeout(timeout));
Status s = Recv(buf, num_to_read, &inc_num_read);
@@ -556,7 +559,8 @@ Status Socket::BlockingRecv(uint8_t *buf, size_t amt,
size_t *nread, const MonoT
continue;
}
if (s.posix_code() == EAGAIN) {
- return Status::TimedOut("");
+ return Status::TimedOut(Substitute("received $0 of $1 requested bytes",
+ tot_read, amt));
}
return s.CloneAndPrepend("BlockingRecv error");
}