From 11f55888a27757f4c934f9a50dc499a3ffd8a2f3 Mon Sep 17 00:00:00 2001 From: David Boucher Date: Fri, 9 Jul 2021 12:19:07 +0200 Subject: [PATCH] fix(various): centengine segfaults when it is terminated. (#528) * fix(externalcmd): pthread_cancel() is not compatible with new C++11 ABI. * fix(externalcmd): main externalcmd function had a bad name REFS: MON-10682 --- CHANGELOG.md | 8 +- deps.sh | 9 +- enginerpc/enginerpc.cc | 13 +- inc/com/centreon/engine/common.hh | 3 - inc/com/centreon/engine/enginerpc.hh | 6 +- inc/com/centreon/engine/globals.hh | 1 - .../engine/modules/external_commands/utils.hh | 2 - modules/external_commands/src/utils.cc | 156 ++++++------------ src/globals.cc | 3 - tests/enginerpc/enginerpc.cc | 67 +++----- 10 files changed, 102 insertions(+), 166 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc427fdab..61b509c2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ ### Bugs +*external commands* + +The new C++ standard is not compatible with pthread\_cancel(). This last one has +been removed from the code. + *gRPC* The reflection module has been removed because of an issue in the compilation. @@ -20,7 +25,8 @@ one would be enough. ### Build -repair the compilation for Raspberry PI +repair the compilation for Raspberry PI. Link between cbmod and neb module is +also rectified. ## 21.04.2 diff --git a/deps.sh b/deps.sh index 1dcfcf3b7..9501e55fe 100755 --- a/deps.sh +++ b/deps.sh @@ -2,5 +2,10 @@ go run deps.go "$*" > /tmp/deps.dot dot -Tpng /tmp/deps.dot -o deps.png -eog deps.png& - +if [ -x /usr/bin/eog ] ; then + eog deps.png& +elif [ -x /usr/bin/lximage-qt ] ; then + lximage-qt deps.png& +elif [ -x /usr/bin/lximage ] ; then + lximage deps.png& +fi diff --git a/enginerpc/enginerpc.cc b/enginerpc/enginerpc.cc index 24bf5ae76..4e436260c 100644 --- a/enginerpc/enginerpc.cc +++ b/enginerpc/enginerpc.cc @@ -17,21 +17,18 @@ * */ -#include -#include "com/centreon/engine/logging/logger.hh" -#include #include "com/centreon/engine/enginerpc.hh" +#include +#include +#include "com/centreon/engine/logging/logger.hh" using namespace com::centreon::engine; enginerpc::enginerpc(const std::string& address, uint16_t port) { - engine_impl* service = new engine_impl; - std::ostringstream oss; - oss << address << ":" << port; - std::string server_address{oss.str()}; + std::string server_address{fmt::format("{}:{}", address, port)}; grpc::ServerBuilder builder; builder.AddListeningPort(server_address, grpc::InsecureServerCredentials()); - builder.RegisterService(service); + builder.RegisterService(&_service); _server = builder.BuildAndStart(); } diff --git a/inc/com/centreon/engine/common.hh b/inc/com/centreon/engine/common.hh index c575e54f0..60c90a2b5 100644 --- a/inc/com/centreon/engine/common.hh +++ b/inc/com/centreon/engine/common.hh @@ -325,7 +325,4 @@ enum ret_val { #define HOST_STATECHANGE 0 #define SERVICE_STATECHANGE 1 -/* Thread stuff. */ -#define TOTAL_WORKER_THREADS 1 - #endif /* !CCE_COMMON_HH */ diff --git a/inc/com/centreon/engine/enginerpc.hh b/inc/com/centreon/engine/enginerpc.hh index 51dfae11d..5e0041ebe 100644 --- a/inc/com/centreon/engine/enginerpc.hh +++ b/inc/com/centreon/engine/enginerpc.hh @@ -1,15 +1,17 @@ #ifndef CCE_ENGINERPC_ENGINERPC_HH #define CCE_ENGINERPC_ENGINERPC_HH -#include -#include #include +#include +#include #include "com/centreon/engine/namespace.hh" #include "engine_impl.hh" CCE_BEGIN() class enginerpc final { + engine_impl _service; std::unique_ptr _server; + public: enginerpc(const std::string& address, uint16_t port); enginerpc() = delete; diff --git a/inc/com/centreon/engine/globals.hh b/inc/com/centreon/engine/globals.hh index 80d518aed..efa3fd0ec 100644 --- a/inc/com/centreon/engine/globals.hh +++ b/inc/com/centreon/engine/globals.hh @@ -86,7 +86,6 @@ extern time_t program_start; extern time_t event_start; extern circular_buffer external_command_buffer; -extern pthread_t worker_threads[]; extern check_stats check_statistics[]; diff --git a/modules/external_commands/inc/com/centreon/engine/modules/external_commands/utils.hh b/modules/external_commands/inc/com/centreon/engine/modules/external_commands/utils.hh index 2ab96ac86..09cefacaa 100644 --- a/modules/external_commands/inc/com/centreon/engine/modules/external_commands/utils.hh +++ b/modules/external_commands/inc/com/centreon/engine/modules/external_commands/utils.hh @@ -32,8 +32,6 @@ int close_command_file(); // closes and deletes the external command file // (FIFO) int init_command_file_worker_thread(void); int shutdown_command_file_worker_thread(void); -void cleanup_command_file_worker_thread(void* arg); -void* command_file_worker_thread(void* arg); int submit_external_command(char const* cmd, int* buffer_items); #ifdef __cplusplus diff --git a/modules/external_commands/src/utils.cc b/modules/external_commands/src/utils.cc index 97792c985..d2f14a134 100644 --- a/modules/external_commands/src/utils.cc +++ b/modules/external_commands/src/utils.cc @@ -1,5 +1,6 @@ /* ** Copyright 2011-2013 Merethis +** Copyright 2020-2021 Centreon ** ** This file is part of Centreon Engine. ** @@ -20,15 +21,14 @@ #include "com/centreon/engine/modules/external_commands/utils.hh" #include #include -#include #include -#include #include +#include #include #include #include -#include -#include +#include +#include #include "com/centreon/engine/common.hh" #include "com/centreon/engine/globals.hh" #include "com/centreon/engine/logging/logger.hh" @@ -43,6 +43,9 @@ static int command_file_fd = -1; static int command_file_created = false; static FILE* command_file_fp = NULL; +static std::unique_ptr worker; +static std::atomic_bool should_exit{false}; + /* creates external command file as a named pipe (FIFO) and opens it for reading * (non-blocked mode) */ int open_command_file(void) { @@ -64,7 +67,7 @@ int open_command_file(void) { (st.st_mode & S_IFIFO))) { /* create the external command file as a named pipe (FIFO) */ if (mkfifo(config->command_file().c_str(), - S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) != 0) { + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) != 0) { logger(log_runtime_error, basic) << "Error: Could not create external command file '" << config->command_file() << "' as named pipe: (" << errno << ") -> " @@ -158,81 +161,10 @@ int close_command_file(void) { return OK; } -/* initializes command file worker thread */ -int init_command_file_worker_thread(void) { - int result = 0; - sigset_t newmask; - - /* initialize circular buffer */ - external_command_buffer.head = 0; - external_command_buffer.tail = 0; - external_command_buffer.items = 0; - external_command_buffer.high = 0; - external_command_buffer.overflow = 0L; - external_command_buffer.buffer = - new void*[config->external_command_buffer_slots()]; - if (external_command_buffer.buffer == NULL) - return ERROR; - - /* initialize mutex (only on cold startup) */ - if (sigrestart == false) - pthread_mutex_init(&external_command_buffer.buffer_lock, NULL); - - /* new thread should block all signals */ - sigfillset(&newmask); - pthread_sigmask(SIG_BLOCK, &newmask, NULL); - - /* create worker thread */ - result = pthread_create(&worker_threads[COMMAND_WORKER_THREAD], NULL, - command_file_worker_thread, NULL); - - /* main thread should unblock all signals */ - pthread_sigmask(SIG_UNBLOCK, &newmask, NULL); - - if (result) - return ERROR; - - return OK; -} - -/* shutdown command file worker thread */ -int shutdown_command_file_worker_thread(void) { - int result = 0; - - /* - * calling pthread_cancel(0) will cause segfaults with some - * thread libraries. It's possible that will happen if the - * user has a number of config files larger than the max - * open file descriptor limit (ulimit -n) and some retarded - * eventbroker module leaks filedescriptors, since we'll then - * enter the cleanup() routine from main() before we've - * spawned any threads. - */ - if (worker_threads[COMMAND_WORKER_THREAD]) { - /* tell the worker thread to exit */ - result = pthread_cancel(worker_threads[COMMAND_WORKER_THREAD]); - - /* wait for the worker thread to exit */ - if (result == 0) - pthread_join(worker_threads[COMMAND_WORKER_THREAD], NULL); - /* we're being called from a fork()'ed child process - can't cancel thread, - * so just cleanup memory */ - else { - cleanup_command_file_worker_thread(NULL); - } - } - - return OK; -} - /* clean up resources used by command file worker thread */ -void cleanup_command_file_worker_thread(void* arg) { - int x = 0; - - (void)arg; - +static void cleanup_command_file_worker_thread() { /* release memory allocated to circular buffer */ - for (x = external_command_buffer.tail; x != external_command_buffer.head; + for (int x = external_command_buffer.tail; x != external_command_buffer.head; x = (x + 1) % config->external_command_buffer_slots()) { delete[]((char**)external_command_buffer.buffer)[x]; ((char**)external_command_buffer.buffer)[x] = NULL; @@ -242,24 +174,14 @@ void cleanup_command_file_worker_thread(void* arg) { } /* worker thread - artificially increases buffer of named pipe */ -void* command_file_worker_thread(void* arg) { +static void command_file_worker_thread() { char input_buffer[MAX_EXTERNAL_COMMAND_LENGTH]; struct pollfd pfd; int pollval; struct timeval tv; int buffer_items = 0; - (void)arg; - - /* specify cleanup routine */ - pthread_cleanup_push(cleanup_command_file_worker_thread, NULL); - - /* set cancellation info */ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); - - while (1) { - /* should we shutdown? */ + while (!should_exit) { pthread_testcancel(); /* wait for data to arrive */ @@ -311,9 +233,6 @@ void* command_file_worker_thread(void* arg) { continue; } - /* should we shutdown? */ - pthread_testcancel(); - /* get number of items in the buffer */ pthread_mutex_lock(&external_command_buffer.buffer_lock); buffer_items = external_command_buffer.items; @@ -338,7 +257,8 @@ void* command_file_worker_thread(void* arg) { clearerr(command_file_fp); /* read and process the next command in the file */ - while (fgets(input_buffer, (int)(sizeof(input_buffer) - 1), + while (!should_exit && + fgets(input_buffer, (int)(sizeof(input_buffer) - 1), command_file_fp) != nullptr) { // Check if command is thread-safe (for immediate execution). if (modules::external_commands::gl_processor.is_thread_safe( @@ -347,33 +267,61 @@ void* command_file_worker_thread(void* arg) { // Submit the external command for processing // (retry if buffer is full). else { - while (submit_external_command(input_buffer, &buffer_items) == + while (!should_exit && + submit_external_command(input_buffer, &buffer_items) == ERROR && buffer_items == config->external_command_buffer_slots()) { // Wait a bit. tv.tv_sec = 0; tv.tv_usec = 250000; select(0, nullptr, nullptr, nullptr, &tv); - - // Should we shutdown? - pthread_testcancel(); } // Bail if the circular buffer is full. if (buffer_items == config->external_command_buffer_slots()) break; - - // Should we shutdown? - pthread_testcancel(); } } } } - /* removes cleanup handler - this should never be reached */ - pthread_cleanup_pop(0); + cleanup_command_file_worker_thread(); +} + +/* initializes command file worker thread */ +int init_command_file_worker_thread(void) { + /* initialize circular buffer */ + external_command_buffer.head = 0; + external_command_buffer.tail = 0; + external_command_buffer.items = 0; + external_command_buffer.high = 0; + external_command_buffer.overflow = 0L; + external_command_buffer.buffer = + new void*[config->external_command_buffer_slots()]; + if (external_command_buffer.buffer == NULL) + return ERROR; + + /* initialize mutex (only on cold startup) */ + if (!sigrestart) + pthread_mutex_init(&external_command_buffer.buffer_lock, NULL); + + /* create worker thread */ + worker = std::make_unique(&command_file_worker_thread); - return nullptr; + return OK; +} + +/* shutdown command file worker thread */ +int shutdown_command_file_worker_thread(void) { + if (!should_exit) { + /* tell the worker thread to exit */ + should_exit = true; + + /* wait for the worker thread to exit */ + worker->join(); + } + + return OK; } /* submits an external command for processing */ diff --git a/src/globals.cc b/src/globals.cc index c60339813..82f262ecd 100644 --- a/src/globals.cc +++ b/src/globals.cc @@ -22,8 +22,6 @@ #include "com/centreon/engine/globals.hh" -#include - #include "com/centreon/engine/logging/logger.hh" #include "nagios.h" @@ -70,7 +68,6 @@ int test_scheduling(false); int verify_circular_paths(true); int verify_config(false); nebcallback* neb_callback_list[NEBCALLBACK_NUMITEMS]; -pthread_t worker_threads[TOTAL_WORKER_THREADS]; sched_info scheduling_info; time_t event_start((time_t)-1); time_t last_command_check((time_t)-1); diff --git a/tests/enginerpc/enginerpc.cc b/tests/enginerpc/enginerpc.cc index 2647b8776..942b3cafe 100644 --- a/tests/enginerpc/enginerpc.cc +++ b/tests/enginerpc/enginerpc.cc @@ -48,15 +48,12 @@ #include "com/centreon/engine/version.hh" #include "helper.hh" - - using namespace com::centreon; using namespace com::centreon::engine; using namespace com::centreon::engine::downtimes; using namespace com::centreon::engine::configuration; using namespace com::centreon::engine::configuration::applier; - class EngineRpc : public TestEngine { public: void SetUp() override { @@ -222,7 +219,6 @@ static void call_command_manager(std::unique_ptr& th, th.reset(new std::thread(fn)); } - TEST_F(EngineRpc, StartStop) { enginerpc erpc("0.0.0.0", 40001); ASSERT_NO_THROW(erpc.shutdown()); @@ -234,7 +230,7 @@ TEST_F(EngineRpc, GetVersion) { enginerpc erpc("0.0.0.0", 40001); auto output = execute("GetVersion"); ASSERT_EQ(output.front(), oss.str()); - if (output.size() == 2) { + if (output.size() == 2u) { oss.str(""); oss << "minor: " << CENTREON_ENGINE_VERSION_MINOR; ASSERT_EQ(output.back(), oss.str()); @@ -318,8 +314,6 @@ TEST_F(EngineRpc, GetWrongHost) { erpc.shutdown(); } - - TEST_F(EngineRpc, GetService) { enginerpc erpc("0.0.0.0", 40001); std::unique_ptr th; @@ -371,8 +365,7 @@ TEST_F(EngineRpc, GetWrongService) { "Host name: ", "Serv desc: ", "Service state: 0", - "Service period: " - }; + "Service period: "}; _svc->set_current_state(engine::service::state_critical); call_command_manager(th, &condvar, &mutex, &continuerunning); @@ -392,7 +385,6 @@ TEST_F(EngineRpc, GetWrongService) { erpc.shutdown(); } - TEST_F(EngineRpc, GetContact) { enginerpc erpc("0.0.0.0", 40001); std::unique_ptr th; @@ -426,8 +418,8 @@ TEST_F(EngineRpc, GetWrongContact) { std::condition_variable condvar; std::mutex mutex; bool continuerunning = false; - std::vector vectests = {"GetContact rpc engine failed", "GetContact", "", "", - ""}; + std::vector vectests = {"GetContact rpc engine failed", + "GetContact", "", "", ""}; call_command_manager(th, &condvar, &mutex, &continuerunning); @@ -446,7 +438,6 @@ TEST_F(EngineRpc, GetWrongContact) { erpc.shutdown(); } - TEST_F(EngineRpc, GetHostsCount) { enginerpc erpc("0.0.0.0", 40001); std::unique_ptr th; @@ -704,9 +695,10 @@ TEST_F(EngineRpc, DeleteWrongComment) { std::condition_variable condvar; std::mutex mutex; bool continuerunning = false; - std::vector vectests = {"DeleteComment failed.", - "DeleteComment 0", - }; + std::vector vectests = { + "DeleteComment failed.", + "DeleteComment 0", + }; call_command_manager(th, &condvar, &mutex, &continuerunning); auto output = execute("DeleteComment 999"); @@ -725,7 +717,6 @@ TEST_F(EngineRpc, DeleteWrongComment) { erpc.shutdown(); } - TEST_F(EngineRpc, DeleteAllHostComments) { enginerpc erpc("0.0.0.0", 40001); std::unique_ptr th; @@ -1016,7 +1007,7 @@ TEST_F(EngineRpc, ScheduleWrongHostDowntime) { call_command_manager(th, &condvar, &mutex, &continuerunning); - // we fake a wrong test with an + // we fake a wrong test with an auto output = execute(oss.str()); ASSERT_EQ("ScheduleHostDowntime 0", output.back()); { @@ -1030,7 +1021,6 @@ TEST_F(EngineRpc, ScheduleWrongHostDowntime) { erpc.shutdown(); } - TEST_F(EngineRpc, ScheduleServiceDowntime) { enginerpc erpc("0.0.0.0", 40001); std::unique_ptr th; @@ -1109,8 +1099,6 @@ TEST_F(EngineRpc, ScheduleWrongServiceDowntime) { erpc.shutdown(); } - - TEST_F(EngineRpc, ScheduleHostServicesDowntime) { enginerpc erpc("0.0.0.0", 40001); std::unique_ptr th; @@ -1482,9 +1470,9 @@ TEST_F(EngineRpc, ChangeHostObjectIntVar) { call_command_manager(th, &condvar, &mutex, &continuerunning); auto output = execute("ChangeHostObjectIntVar test_host 0 1 1.0"); - ASSERT_EQ(_host->get_check_interval(), 1); + ASSERT_EQ(_host->get_check_interval(), 1u); output = execute("ChangeHostObjectIntVar test_host 1 1 2.0"); - ASSERT_EQ(_host->get_retry_interval(), 2); + ASSERT_EQ(_host->get_retry_interval(), 2u); output = execute("ChangeHostObjectIntVar test_host 2 1 1.0"); ASSERT_EQ(_host->get_max_attempts(), 1); { @@ -1508,11 +1496,11 @@ TEST_F(EngineRpc, ChangeServiceObjectIntVar) { auto output = execute( "ChangeServiceObjectIntVar" " test_host test_svc 0 1 1.0"); - ASSERT_EQ(_svc->get_check_interval(), 1); + ASSERT_EQ(_svc->get_check_interval(), 1u); output = execute( "ChangeServiceObjectIntVar" " test_host test_svc 1 1 2.0"); - ASSERT_EQ(_svc->get_retry_interval(), 2); + ASSERT_EQ(_svc->get_retry_interval(), 2u); output = execute( "ChangeServiceObjectIntVar" " test_host test_svc 2 1 1.0"); @@ -1539,15 +1527,15 @@ TEST_F(EngineRpc, ChangeContactObjectIntVar) { auto output = execute( "ChangeContactObjectIntVar" " admin 0 1 1.0"); - ASSERT_EQ(_contact->get_modified_attributes(), 1); + ASSERT_EQ(_contact->get_modified_attributes(), 1u); output = execute( "ChangeContactObjectIntVar" " admin 1 2 1.0"); - ASSERT_EQ(_contact->get_modified_host_attributes(), 2); + ASSERT_EQ(_contact->get_modified_host_attributes(), 2u); output = execute( "ChangeContactObjectIntVar" " admin 2 3 1.0"); - ASSERT_EQ(_contact->get_modified_service_attributes(), 3); + ASSERT_EQ(_contact->get_modified_service_attributes(), 3u); { std::lock_guard lock(mutex); continuerunning = true; @@ -1677,7 +1665,7 @@ TEST_F(EngineRpc, ChangeHostObjectCustomVar) { std::mutex mutex; bool continuerunning = false; - ASSERT_EQ(_host->custom_variables.size(), 0); + ASSERT_EQ(_host->custom_variables.size(), 0u); call_command_manager(th, &condvar, &mutex, &continuerunning); auto output = execute( "ChangeHostObjectCustomVar" @@ -1692,7 +1680,7 @@ TEST_F(EngineRpc, ChangeHostObjectCustomVar) { ASSERT_EQ(_host->custom_variables.size(), 1u); ASSERT_EQ(_host->custom_variables["TEST_VAR"].get_value(), "test_val"); _host->custom_variables.clear(); - ASSERT_EQ(_host->custom_variables.size(), 0); + ASSERT_EQ(_host->custom_variables.size(), 0u); erpc.shutdown(); } @@ -1704,7 +1692,7 @@ TEST_F(EngineRpc, ChangeServiceObjectCustomVar) { bool continuerunning = false; _svc->custom_variables.clear(); - ASSERT_EQ(_svc->custom_variables.size(), 0); + ASSERT_EQ(_svc->custom_variables.size(), 0u); call_command_manager(th, &condvar, &mutex, &continuerunning); auto output = execute( "ChangeServiceObjectCustomVar" @@ -1719,7 +1707,7 @@ TEST_F(EngineRpc, ChangeServiceObjectCustomVar) { ASSERT_EQ(_svc->custom_variables.size(), 1u); ASSERT_EQ(_svc->custom_variables["TEST_VAR"].get_value(), "test_val"); _svc->custom_variables.clear(); - ASSERT_EQ(_svc->custom_variables.size(), 0); + ASSERT_EQ(_svc->custom_variables.size(), 0u); erpc.shutdown(); } @@ -1729,7 +1717,7 @@ TEST_F(EngineRpc, ChangeContactObjectCustomVar) { std::condition_variable condvar; std::mutex mutex; bool continuerunning = false; - ASSERT_EQ(_contact->get_custom_variables().size(), 0); + ASSERT_EQ(_contact->get_custom_variables().size(), 0u); call_command_manager(th, &condvar, &mutex, &continuerunning); auto output = execute( @@ -1748,11 +1736,10 @@ TEST_F(EngineRpc, ChangeContactObjectCustomVar) { erpc.shutdown(); } - TEST_F(EngineRpc, ProcessServiceCheckResult) { enginerpc erpc("0.0.0.0", 40001); auto output = execute("ProcessServiceCheckResult test_host test_svc 0"); - ASSERT_EQ(output.size(), 1); + ASSERT_EQ(output.size(), 1u); ASSERT_EQ(output.front(), "ProcessServiceCheckResult: 0"); erpc.shutdown(); } @@ -1760,7 +1747,7 @@ TEST_F(EngineRpc, ProcessServiceCheckResult) { TEST_F(EngineRpc, ProcessServiceCheckResultBadHost) { enginerpc erpc("0.0.0.0", 40001); auto output = execute("ProcessServiceCheckResult \"\" test_svc 0"); - ASSERT_EQ(output.size(), 2); + ASSERT_EQ(output.size(), 2u); ASSERT_EQ(output.front(), "ProcessServiceCheckResult failed."); erpc.shutdown(); } @@ -1768,7 +1755,7 @@ TEST_F(EngineRpc, ProcessServiceCheckResultBadHost) { TEST_F(EngineRpc, ProcessServiceCheckResultBadService) { enginerpc erpc("0.0.0.0", 40001); auto output = execute("ProcessServiceCheckResult test_host \"\" 0"); - ASSERT_EQ(output.size(), 2); + ASSERT_EQ(output.size(), 2u); ASSERT_EQ(output.front(), "ProcessServiceCheckResult failed."); erpc.shutdown(); } @@ -1776,7 +1763,7 @@ TEST_F(EngineRpc, ProcessServiceCheckResultBadService) { TEST_F(EngineRpc, ProcessHostCheckResult) { enginerpc erpc("0.0.0.0", 40001); auto output = execute("ProcessHostCheckResult test_host 0"); - ASSERT_EQ(output.size(), 1); + ASSERT_EQ(output.size(), 1u); ASSERT_EQ(output.front(), "ProcessHostCheckResult: 0"); erpc.shutdown(); } @@ -1784,7 +1771,7 @@ TEST_F(EngineRpc, ProcessHostCheckResult) { TEST_F(EngineRpc, ProcessHostCheckResultBadHost) { enginerpc erpc("0.0.0.0", 40001); auto output = execute("ProcessHostCheckResult '' 0"); - ASSERT_EQ(output.size(), 2); + ASSERT_EQ(output.size(), 2u); ASSERT_EQ(output.front(), "ProcessHostCheckResult failed."); erpc.shutdown(); } @@ -1802,7 +1789,7 @@ TEST_F(EngineRpc, NewThresholdsFile) { "21,\n \"fit\": 60.5\n }\n]}]"); enginerpc erpc("0.0.0.0", 40001); auto output = execute("NewThresholdsFile /tmp/thresholds_file.json"); - ASSERT_EQ(output.size(), 1); + ASSERT_EQ(output.size(), 1u); ASSERT_EQ(output.front(), "NewThresholdsFile: 0"); command_manager::instance().execute(); ASSERT_EQ(_ad->get_thresholds_file(), "/tmp/thresholds_file.json");