diff --git a/fdbcli/fdbcli.actor.cpp b/fdbcli/fdbcli.actor.cpp index 345668ff5e..97827aca6d 100644 --- a/fdbcli/fdbcli.actor.cpp +++ b/fdbcli/fdbcli.actor.cpp @@ -1191,6 +1191,9 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { ccf = makeReference(resolvedClusterFile.first); wait(ccf->resolveHostnames()); } catch (Error& e) { + if (e.code() == error_code_operation_cancelled) { + throw; + } fprintf(stderr, "%s\n", ClusterConnectionFile::getErrorString(resolvedClusterFile, e).c_str()); return 1; } @@ -1236,6 +1239,9 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { wait(delay(3.0) || success(safeThreadFutureToFuture(tr->getReadVersion()))); break; } catch (Error& e) { + if (e.code() == error_code_operation_cancelled) { + throw; + } if (e.code() == error_code_cluster_version_changed) { wait(safeThreadFutureToFuture(tr->onError(e))); } else { @@ -2023,6 +2029,9 @@ ACTOR Future cli(CLIOptions opt, LineNoise* plinenoise) { TraceEvent(SevInfo, "CLICommandLog", randomID).detail("Command", line).detail("IsError", is_error); } catch (Error& e) { + if (e.code() == error_code_operation_cancelled) { + throw; + } if (e.code() == error_code_tenant_name_required) { printAtCol("ERROR: tenant name required. Use the `usetenant' command to select a tenant or enable the " "`RAW_ACCESS' option to read raw keys.", diff --git a/flow/ThreadHelper.actor.h b/flow/ThreadHelper.actor.h index 639de040b6..7d1f7aa2e9 100644 --- a/flow/ThreadHelper.actor.h +++ b/flow/ThreadHelper.actor.h @@ -698,9 +698,12 @@ Future safeThreadFutureToFutureImpl(ThreadFuture threadFuture) { try { wait(onReady); } catch (Error& e) { - ASSERT(e.code() == error_code_actor_cancelled); + // broken_promise can be thrown if the network is already shut down + ASSERT(e.code() == error_code_operation_cancelled || e.code() == error_code_broken_promise); // prerequisite: we have exclusive ownership of the threadFuture - threadFuture.cancel(); + if (e.code() == error_code_operation_cancelled) { + threadFuture.cancel(); + } throw e; } // threadFuture should be ready