Skip to content

Commit

Permalink
Merge pull request #27 from adickson66/NF-918
Browse files Browse the repository at this point in the history
NF-918 Guard log statements in RpcWrapper from dereferencing null ses…
  • Loading branch information
adickson66 authored Jun 4, 2020
2 parents dbe1f42 + fcab206 commit bce9fd3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions patches/rpcwrapper-logging-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Guard log statements in RpcWrapper from dereferencing null session pointers

From: nobody <nobody@nowhere>


---
src/RpcWrapper.cc | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/RpcWrapper.cc b/src/RpcWrapper.cc
index 60b6cb45..fc2c8ff4 100644
--- a/src/RpcWrapper.cc
+++ b/src/RpcWrapper.cc
@@ -183,7 +183,7 @@ RpcWrapper::isReady() {
|| (responseHeader->status == STATUS_OK)) {
LOG(ERROR, "Response from %s for %s RPC is too short "
"(needed at least %d bytes, got %d)",
- session->serviceLocator.c_str(),
+ session ? session->serviceLocator.c_str() : "(no session)",
WireFormat::opcodeSymbol(&request),
responseHeaderLength,
downCast<int>(response->size()));
@@ -192,6 +192,12 @@ RpcWrapper::isReady() {
// Extend the response buffer to be at least responseHeaderLength
// bytes long.
if (response->size() < responseHeaderLength) {
+ LOG(NOTICE, "Response from %s for %s RPC is too short "
+ "(needed at least %d bytes, got %d) - Extending to required size.",
+ session ? session->serviceLocator.c_str() : "(no session)",
+ WireFormat::opcodeSymbol(&request),
+ responseHeaderLength,
+ downCast<int>(response->size()));
response->alloc(responseHeaderLength - response->size());
}
}
@@ -217,13 +223,13 @@ RpcWrapper::isReady() {
}
RAMCLOUD_CLOG(NOTICE,
"Server %s returned STATUS_RETRY from %s request: %s",
- session->serviceLocator.c_str(),
+ session ? session->serviceLocator.c_str() : "(no session)",
WireFormat::opcodeSymbol(&request),
message);
} else {
RAMCLOUD_CLOG(NOTICE,
"Server %s returned STATUS_RETRY from %s request",
- session->serviceLocator.c_str(),
+ session ? session->serviceLocator.c_str() : "(no session)",
WireFormat::opcodeSymbol(&request));
}
retry(retryResponse->minDelayMicros,
1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ plus_one.patch
transport-timeout-interval.patch
bindings-migration.patch
log-sse42-status.patch
rpcwrapper-logging-fix.patch

0 comments on commit bce9fd3

Please sign in to comment.