From 9fc8fe026baab9959459256f2d47f4bbf21d405a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 21 Oct 2024 11:53:44 +0200 Subject: executor: better handling for hanged test processes Currently we kill hanged processes and consider the corresponding test finished. We don't kill/wait for the actual test subprocess (we don't know its pid to kill, and waiting will presumably hang). This has 2 problems: 1. If the hanged process causes "task hung" report, we can't reproduce it, since the test finished too long ago (manager thinks its finished and discards the request). 2. The test process still consumed per-pid resources. Explicitly detect and handle such cases: Manager keeps these hanged tests forever, and we assign a new proc id for future processes (don't reuse the hanged one). --- executor/executor.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'executor/executor.cc') diff --git a/executor/executor.cc b/executor/executor.cc index 305675bce..5b5e06422 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -470,7 +470,8 @@ static void setup_control_pipes(); static bool coverage_filter(uint64 pc); static rpc::ComparisonRaw convert(const kcov_comparison_t& cmp); static flatbuffers::span finish_output(OutputData* output, int proc_id, uint64 req_id, uint32 num_calls, - uint64 elapsed, uint64 freshness, uint32 status, const std::vector* process_output); + uint64 elapsed, uint64 freshness, uint32 status, bool hanged, + const std::vector* process_output); static void parse_execute(const execute_req& req); static void parse_handshake(const handshake_req& req); @@ -1343,7 +1344,7 @@ void write_extra_output() } flatbuffers::span finish_output(OutputData* output, int proc_id, uint64 req_id, uint32 num_calls, uint64 elapsed, - uint64 freshness, uint32 status, const std::vector* process_output) + uint64 freshness, uint32 status, bool hanged, const std::vector* process_output) { // In snapshot mode the output size is fixed and output_size is always initialized, so use it. int out_size = flag_snapshot ? output_size : output->size.load(std::memory_order_relaxed) ? @@ -1376,7 +1377,7 @@ flatbuffers::span finish_output(OutputData* output, int proc_id, uint64 flatbuffers::Offset> output_off = 0; if (process_output) output_off = fbb.CreateVector(*process_output); - auto exec_off = rpc::CreateExecResultRaw(fbb, req_id, proc_id, output_off, error_off, prog_info_off); + auto exec_off = rpc::CreateExecResultRaw(fbb, req_id, proc_id, output_off, hanged, error_off, prog_info_off); auto msg_off = rpc::CreateExecutorMessageRaw(fbb, rpc::ExecutorMessagesRaw::ExecResult, flatbuffers::Offset(exec_off.o)); fbb.FinishSizePrefixed(msg_off); -- cgit mrf-deployment