From c8455237eaa0de0ee915a41a94560f031cd43684 Mon Sep 17 00:00:00 2001 From: Chaoguang Lin Date: Mon, 4 Apr 2022 10:46:02 -0700 Subject: [PATCH] Fix the bug where use the pointer after it's cleaned --- fdbserver/RemoteIKeyValueStore.actor.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/fdbserver/RemoteIKeyValueStore.actor.h b/fdbserver/RemoteIKeyValueStore.actor.h index 7df95aa2e8..0465e4afbb 100644 --- a/fdbserver/RemoteIKeyValueStore.actor.h +++ b/fdbserver/RemoteIKeyValueStore.actor.h @@ -454,6 +454,7 @@ struct RemoteIKeyValueStore : public IKeyValueStore { } state Future connectionCheckingDelay = delay(FLOW_KNOBS->FAILURE_DETECTION_DELAY); state Future> storeError = errorOr(self->interf.getError.getReply(IKVSGetErrorRequest{})); + state NetworkAddress childAddr = self->interf.getError.getEndpoint().getPrimaryAddress(); loop choose { when(ErrorOr e = wait(storeError)) { TraceEvent(SevDebug, "RemoteIKVSGetError") @@ -474,9 +475,7 @@ struct RemoteIKeyValueStore : public IKeyValueStore { when(wait(connectionCheckingDelay)) { // for the corner case where the child process stuck and waitpid also does not give update on it // In this scenario, we need to manually reboot the storage engine process - if (IFailureMonitor::failureMonitor() - .getState(self->interf.getError.getEndpoint().getPrimaryAddress()) - .isFailed()) { + if (IFailureMonitor::failureMonitor().getState(childAddr).isFailed()) { TraceEvent(SevError, "RemoteKVStoreConnectionStuck").log(); throw please_reboot_remote_kv_store(); // this will reboot the worker }