CLI - cancel execution upon signal reception#367
Conversation
In preparation of sharing functionality for signal handling, extract what we have right now into SignalHandler. Status: draft For fixing envoyproxy#280 Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
…ndler Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
…ndler Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
…ation Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
…ation Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
|
@eric846 please review and assign to me once ready. |
…ation Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
| cluster_manager_ = cluster_manager_factory_->clusterManagerFromProto(bootstrap); | ||
| maybeCreateTracingDriver(bootstrap.tracing()); | ||
| cluster_manager_->setInitializedCb([this]() -> void { init_manager_.initialize(init_watcher_); }); | ||
| { |
There was a problem hiding this comment.
Note to reviewers: The "hide whitespace" toggle in Github makes this a lot more fun to review.
(The scope introduced for the lock guard introduces a lot of whitespace noise).
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
|
Thanks @eric846 for the review. Just marked this as ready for another pass |
source/client/client.cc
Outdated
| OutputFormatterFactoryImpl output_formatter_factory; | ||
| OutputCollectorImpl output_collector(time_system, *options_); | ||
| const bool res = process->run(output_collector); | ||
| bool res; |
There was a problem hiding this comment.
(nit) If we can, we should try to avoid abbreviations in variable names (res).
source/client/remote_process_impl.cc
Outdated
|
|
||
| bool RemoteProcessImpl::requestExecutionCancellation() { | ||
| ENVOY_LOG(error, "Remote process cancellation not supported yet"); | ||
| // TODO(XXX): Send a cancel request to the gRPC service. |
There was a problem hiding this comment.
Did we want to replace XXX with a value?
There was a problem hiding this comment.
I filed #380 (and updated XXX to #380) in the changes I'm about to push.
|
|
||
| void configureComponentLogLevels(spdlog::level::level_enum level); | ||
| const std::vector<ClientWorkerPtr>& createWorkers(const uint32_t concurrency); | ||
| void createWorkers(const uint32_t concurrency); |
There was a problem hiding this comment.
(optional) Is this a good time to document the method?
|
|
||
|
|
||
| def send_sigterm(p): | ||
| # Sleep for a while, under tsan the client needs a lot of time |
There was a problem hiding this comment.
Can we add a Python style docstring, since the function is public.
| assertCounterEqual(counters, "benchmark.http_2xx", (total_requests)) | ||
|
|
||
|
|
||
| def send_sigterm(p): |
There was a problem hiding this comment.
Can we choose a more readable name than "p".
| stdout, stderr = client_process.communicate() | ||
| client_process.wait() | ||
| output = stdout.decode('utf-8') | ||
| assert (client_process.returncode == 0) |
There was a problem hiding this comment.
Can we add a custom error message giving some context?
Or should this be a regular test assertion like below?
| if (do_cancel) { | ||
| cancel_thread = std::thread([&process, terminate_right_away] { | ||
| if (!terminate_right_away) { | ||
| sleep(5); |
There was a problem hiding this comment.
Should we add a comment explaining the sleep and the choice of 5?
Signed-off-by: Otto van der Schaaf <oschaaf@we-amp.com>
Teach the CLI to handle SIGTERM/SIGINT, and handle those as a request to gracefully cancel execution. Partially resolves envoyproxy#280
Teach the CLI to handle SIGTERM/SIGINT, and handle those as a request to
gracefully cancel execution.
Partially resolves #280