From 58ceadbd0efa5e2241400007ae2b5198dba223cb Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Thu, 2 Apr 2026 01:08:03 +0200 Subject: [PATCH 01/10] restrict rest workers based on open files limit --- src/config.cpp | 26 ++++++++++++++++++++++++-- src/test/ovmsconfig_test.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 3222e775b1..f8fa8749e5 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -43,12 +43,28 @@ const uint32_t AVAILABLE_CORES = getCoreCount(); const uint32_t WIN_MAX_GRPC_WORKERS = 1; const uint32_t MAX_PORT_NUMBER = std::numeric_limits::max(); -// For drogon, we need to minimize the number of default workers since this value is set for both: unary and streaming (making it always double) -const uint64_t DEFAULT_REST_WORKERS = AVAILABLE_CORES; const uint32_t DEFAULT_GRPC_MAX_THREADS = AVAILABLE_CORES * 8.0; const size_t DEFAULT_GRPC_MEMORY_QUOTA = (size_t)2 * 1024 * 1024 * 1024; // 2GB const uint64_t MAX_REST_WORKERS = 10'000; +// We need to minimize the number of default drogon workers since this value is set for both: unary and streaming (making it always double) +// on linux, restrict also based on the max allowed number of open files +#ifdef __linux__ +#include +const uint64_t MAX_OPEN_FILES = []() { + struct rlimit limit; + if (getrlimit(RLIMIT_NOFILE, &limit) == 0) { + return limit.rlim_cur; + } + return std::numeric_limits::max(); +}(); +const uint64_t RESERVED_OPEN_FILES = 10; // we need to reserve some file descriptors for other operations, so we don't want to use all of them for drogon workers +const uint64_t DEFAULT_REST_WORKERS = (MAX_OPEN_FILES <= RESERVED_OPEN_FILES) ? AVAILABLE_CORES + : std::min(static_cast(AVAILABLE_CORES), (MAX_OPEN_FILES - RESERVED_OPEN_FILES) / 5); +#else +const uint64_t DEFAULT_REST_WORKERS = AVAILABLE_CORES; +#endif + Config& Config::parse(int argc, char** argv) { ovms::CLIParser parser; ovms::ServerSettingsImpl serverSettings; @@ -306,6 +322,12 @@ bool Config::validate() { std::cerr << "rest_workers is set but rest_port is not set. rest_port is required to start rest servers" << std::endl; return false; } +#ifdef __linux__ + if (restWorkers() > (MAX_OPEN_FILES - RESERVED_OPEN_FILES) / 5) { + std::cerr << "rest_workers count cannot be larger than " << (MAX_OPEN_FILES - RESERVED_OPEN_FILES) / 5 << " due to open files limit. Current open files limit: " << MAX_OPEN_FILES << std::endl; + return false; + } +#endif #ifdef _WIN32 if (grpcWorkers() > WIN_MAX_GRPC_WORKERS) { diff --git a/src/test/ovmsconfig_test.cpp b/src/test/ovmsconfig_test.cpp index 5e6f694f56..7f5b43b420 100644 --- a/src/test/ovmsconfig_test.cpp +++ b/src/test/ovmsconfig_test.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -202,6 +203,36 @@ TEST_F(OvmsConfigDeathTest, restWorkersTooLarge) { EXPECT_EXIT(ovms::Config::instance().parse(arg_count, n_argv), ::testing::ExitedWithCode(OVMS_EX_USAGE), "rest_workers count should be from 2 to "); } +TEST_F(OvmsConfigDeathTest, restWorkersDefaultReducedForOpenFilesLimit) { + // limit allowed number of open files to 1024 to make sure that rest_workers count is too large for the limit based on number of cpu cores alone + int cpu_cores = ovms::getCoreCount(); + struct rlimit limit; + ASSERT_EQ(getrlimit(RLIMIT_NOFILE, &limit), 0); + struct rlimit newLimit = {static_cast(cpu_cores * 5), limit.rlim_max}; + std::cout << "Setting open files limit to " << newLimit.rlim_cur << " to test that default rest_workers count is reduced based on open files limit" << std::endl; + ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &newLimit), 0); + + char* n_argv[] = {"ovms", "--config_path", "/path1", "--rest_port", "8080", "--port", "8081"}; + int arg_count = 7; + ovms::Config::instance().parse(arg_count, n_argv); + EXPECT_TRUE(ovms::Config::instance().validate()); + + ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); +} + +TEST_F(OvmsConfigDeathTest, restWorkersTooLargeForOpenFilesLimit) { + // limit allowed number of open files to 1024 to make sure that rest_workers count is too large. + struct rlimit limit; + ASSERT_EQ(getrlimit(RLIMIT_NOFILE, &limit), 0); + struct rlimit newLimit = {1024, limit.rlim_max}; + std::cout << "Setting open files limit to " << newLimit.rlim_cur << " to test that rest_workers count is too large for the limit based on number of cpu cores alone" << std::endl; + ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &newLimit), 0); + char* n_argv[] = {"ovms", "--config_path", "/path1", "--rest_port", "8080", "--port", "8081", "--rest_workers", "1000"}; + int arg_count = 9; + EXPECT_EXIT(ovms::Config::instance().parse(arg_count, n_argv), ::testing::ExitedWithCode(OVMS_EX_USAGE), "rest_workers count cannot be larger than 202 due to open files limit. Current open files limit: 1024"); + ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); +} + TEST_F(OvmsConfigDeathTest, restWorkersDefinedRestPortUndefined) { char* n_argv[] = {"ovms", "--config_path", "/path1", "--port", "8080", "--rest_workers", "60"}; int arg_count = 7; From d55e2b3719a43c6abf03b26f173cad10e1a573f9 Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Thu, 2 Apr 2026 09:18:52 +0200 Subject: [PATCH 02/10] style --- src/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.cpp b/src/config.cpp index f8fa8749e5..3782f8ea1a 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -14,7 +14,7 @@ // limitations under the License. //***************************************************************************** #include "config.hpp" - +#include #include #include #include From 5821c8a48080d38b77b54200c813083724428d8c Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Thu, 2 Apr 2026 10:34:46 +0200 Subject: [PATCH 03/10] win build --- src/config.cpp | 5 ++++- src/test/ovmsconfig_test.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 3782f8ea1a..be9d8d5327 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -37,6 +37,10 @@ #include "stringutils.hpp" #include "systeminfo.hpp" +#ifdef __linux__ +#include +#endif + namespace ovms { const uint32_t AVAILABLE_CORES = getCoreCount(); @@ -50,7 +54,6 @@ const uint64_t MAX_REST_WORKERS = 10'000; // We need to minimize the number of default drogon workers since this value is set for both: unary and streaming (making it always double) // on linux, restrict also based on the max allowed number of open files #ifdef __linux__ -#include const uint64_t MAX_OPEN_FILES = []() { struct rlimit limit; if (getrlimit(RLIMIT_NOFILE, &limit) == 0) { diff --git a/src/test/ovmsconfig_test.cpp b/src/test/ovmsconfig_test.cpp index 7f5b43b420..7b719e351a 100644 --- a/src/test/ovmsconfig_test.cpp +++ b/src/test/ovmsconfig_test.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include @@ -32,6 +31,10 @@ #include "../systeminfo.hpp" #include "test_utils.hpp" +#ifdef __linux__ +#include +#endif + using testing::_; using testing::ContainerEq; using testing::Return; From 56c9b8d580abfdad26a522ec292fcf7baeef3bf2 Mon Sep 17 00:00:00 2001 From: "Trawinski, Dariusz" Date: Thu, 2 Apr 2026 13:30:16 +0200 Subject: [PATCH 04/10] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- src/config.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index be9d8d5327..2184f34c99 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -54,16 +54,25 @@ const uint64_t MAX_REST_WORKERS = 10'000; // We need to minimize the number of default drogon workers since this value is set for both: unary and streaming (making it always double) // on linux, restrict also based on the max allowed number of open files #ifdef __linux__ -const uint64_t MAX_OPEN_FILES = []() { + +namespace { +uint64_t getMaxOpenFilesLimit() { struct rlimit limit; if (getrlimit(RLIMIT_NOFILE, &limit) == 0) { return limit.rlim_cur; } return std::numeric_limits::max(); -}(); +} +} // namespace + const uint64_t RESERVED_OPEN_FILES = 10; // we need to reserve some file descriptors for other operations, so we don't want to use all of them for drogon workers -const uint64_t DEFAULT_REST_WORKERS = (MAX_OPEN_FILES <= RESERVED_OPEN_FILES) ? AVAILABLE_CORES - : std::min(static_cast(AVAILABLE_CORES), (MAX_OPEN_FILES - RESERVED_OPEN_FILES) / 5); +const uint64_t DEFAULT_REST_WORKERS = []() { + const uint64_t maxOpenFiles = getMaxOpenFilesLimit(); + if (maxOpenFiles <= RESERVED_OPEN_FILES) { + return static_cast(AVAILABLE_CORES); + } + return std::min(static_cast(AVAILABLE_CORES), (maxOpenFiles - RESERVED_OPEN_FILES) / 5); +}(); #else const uint64_t DEFAULT_REST_WORKERS = AVAILABLE_CORES; #endif From c452b51140ddc42eb3d9832703588bd17e9251a2 Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Thu, 2 Apr 2026 16:38:07 +0200 Subject: [PATCH 05/10] fix tests --- src/config.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 2184f34c99..608f6e143c 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -55,26 +55,26 @@ const uint64_t MAX_REST_WORKERS = 10'000; // on linux, restrict also based on the max allowed number of open files #ifdef __linux__ -namespace { -uint64_t getMaxOpenFilesLimit() { +static uint64_t getMaxOpenFilesLimit() { struct rlimit limit; if (getrlimit(RLIMIT_NOFILE, &limit) == 0) { return limit.rlim_cur; } return std::numeric_limits::max(); } -} // namespace const uint64_t RESERVED_OPEN_FILES = 10; // we need to reserve some file descriptors for other operations, so we don't want to use all of them for drogon workers -const uint64_t DEFAULT_REST_WORKERS = []() { +uint64_t getDefaultRestWorkers() { const uint64_t maxOpenFiles = getMaxOpenFilesLimit(); if (maxOpenFiles <= RESERVED_OPEN_FILES) { - return static_cast(AVAILABLE_CORES); + return static_cast(2); // minimum functional number } return std::min(static_cast(AVAILABLE_CORES), (maxOpenFiles - RESERVED_OPEN_FILES) / 5); -}(); +} #else -const uint64_t DEFAULT_REST_WORKERS = AVAILABLE_CORES; +uint64_t getDefaultRestWorkers() { + return AVAILABLE_CORES; +} #endif Config& Config::parse(int argc, char** argv) { @@ -335,8 +335,8 @@ bool Config::validate() { return false; } #ifdef __linux__ - if (restWorkers() > (MAX_OPEN_FILES - RESERVED_OPEN_FILES) / 5) { - std::cerr << "rest_workers count cannot be larger than " << (MAX_OPEN_FILES - RESERVED_OPEN_FILES) / 5 << " due to open files limit. Current open files limit: " << MAX_OPEN_FILES << std::endl; + if (restWorkers() > (getMaxOpenFilesLimit() - RESERVED_OPEN_FILES) / 5) { + std::cerr << "rest_workers count cannot be larger than " << (getMaxOpenFilesLimit() - RESERVED_OPEN_FILES) / 5 << " due to open files limit. Current open files limit: " << getMaxOpenFilesLimit() << std::endl; return false; } #endif @@ -402,7 +402,7 @@ const std::string Config::restBindAddress() const { return this->serverSettings. uint32_t Config::grpcWorkers() const { return this->serverSettings.grpcWorkers; } uint32_t Config::grpcMaxThreads() const { return this->serverSettings.grpcMaxThreads.value_or(DEFAULT_GRPC_MAX_THREADS); } size_t Config::grpcMemoryQuota() const { return this->serverSettings.grpcMemoryQuota.value_or(DEFAULT_GRPC_MEMORY_QUOTA); } -uint32_t Config::restWorkers() const { return this->serverSettings.restWorkers.value_or(DEFAULT_REST_WORKERS); } +uint32_t Config::restWorkers() const { return this->serverSettings.restWorkers.value_or(getDefaultRestWorkers()); } const std::string& Config::modelName() const { return this->modelsSettings.modelName; } const std::string& Config::modelPath() const { return this->modelsSettings.modelPath; } const std::string& Config::batchSize() const { From 502a8538cd43c40415d6d7194ef79dc428255acf Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Thu, 2 Apr 2026 16:58:13 +0200 Subject: [PATCH 06/10] fix win tests --- src/test/ovmsconfig_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/ovmsconfig_test.cpp b/src/test/ovmsconfig_test.cpp index 7b719e351a..c8fd57a0e4 100644 --- a/src/test/ovmsconfig_test.cpp +++ b/src/test/ovmsconfig_test.cpp @@ -206,6 +206,7 @@ TEST_F(OvmsConfigDeathTest, restWorkersTooLarge) { EXPECT_EXIT(ovms::Config::instance().parse(arg_count, n_argv), ::testing::ExitedWithCode(OVMS_EX_USAGE), "rest_workers count should be from 2 to "); } +#ifdef __linux__ TEST_F(OvmsConfigDeathTest, restWorkersDefaultReducedForOpenFilesLimit) { // limit allowed number of open files to 1024 to make sure that rest_workers count is too large for the limit based on number of cpu cores alone int cpu_cores = ovms::getCoreCount(); @@ -222,6 +223,7 @@ TEST_F(OvmsConfigDeathTest, restWorkersDefaultReducedForOpenFilesLimit) { ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); } +#endif TEST_F(OvmsConfigDeathTest, restWorkersTooLargeForOpenFilesLimit) { // limit allowed number of open files to 1024 to make sure that rest_workers count is too large. From 9d534d8e8cfd52500000ed4014a95d94e4652a0f Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Thu, 2 Apr 2026 17:15:38 +0200 Subject: [PATCH 07/10] fix win tests2 --- src/test/ovmsconfig_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ovmsconfig_test.cpp b/src/test/ovmsconfig_test.cpp index c8fd57a0e4..7d472ef5ce 100644 --- a/src/test/ovmsconfig_test.cpp +++ b/src/test/ovmsconfig_test.cpp @@ -223,7 +223,6 @@ TEST_F(OvmsConfigDeathTest, restWorkersDefaultReducedForOpenFilesLimit) { ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); } -#endif TEST_F(OvmsConfigDeathTest, restWorkersTooLargeForOpenFilesLimit) { // limit allowed number of open files to 1024 to make sure that rest_workers count is too large. @@ -237,6 +236,7 @@ TEST_F(OvmsConfigDeathTest, restWorkersTooLargeForOpenFilesLimit) { EXPECT_EXIT(ovms::Config::instance().parse(arg_count, n_argv), ::testing::ExitedWithCode(OVMS_EX_USAGE), "rest_workers count cannot be larger than 202 due to open files limit. Current open files limit: 1024"); ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); } +#endif TEST_F(OvmsConfigDeathTest, restWorkersDefinedRestPortUndefined) { char* n_argv[] = {"ovms", "--config_path", "/path1", "--port", "8080", "--rest_workers", "60"}; From eab2fea045757afe582fa3b26e7caf71ed7030f5 Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Fri, 3 Apr 2026 00:05:57 +0200 Subject: [PATCH 08/10] improve limits --- src/config.cpp | 8 ++++---- src/test/ovmsconfig_test.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/config.cpp b/src/config.cpp index 608f6e143c..67b9ccde8a 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -63,13 +63,13 @@ static uint64_t getMaxOpenFilesLimit() { return std::numeric_limits::max(); } -const uint64_t RESERVED_OPEN_FILES = 10; // we need to reserve some file descriptors for other operations, so we don't want to use all of them for drogon workers +const uint64_t RESERVED_OPEN_FILES = 15; // we need to reserve some file descriptors for other operations, so we don't want to use all of them for drogon workers uint64_t getDefaultRestWorkers() { const uint64_t maxOpenFiles = getMaxOpenFilesLimit(); if (maxOpenFiles <= RESERVED_OPEN_FILES) { return static_cast(2); // minimum functional number } - return std::min(static_cast(AVAILABLE_CORES), (maxOpenFiles - RESERVED_OPEN_FILES) / 5); + return std::min(static_cast(AVAILABLE_CORES), (maxOpenFiles - RESERVED_OPEN_FILES) / 7); // 5x rest_workers to initialize ovms and 2x rest_workers for new connections } #else uint64_t getDefaultRestWorkers() { @@ -335,8 +335,8 @@ bool Config::validate() { return false; } #ifdef __linux__ - if (restWorkers() > (getMaxOpenFilesLimit() - RESERVED_OPEN_FILES) / 5) { - std::cerr << "rest_workers count cannot be larger than " << (getMaxOpenFilesLimit() - RESERVED_OPEN_FILES) / 5 << " due to open files limit. Current open files limit: " << getMaxOpenFilesLimit() << std::endl; + if (restWorkers() > (getMaxOpenFilesLimit() - RESERVED_OPEN_FILES) / 6) { + std::cerr << "rest_workers count cannot be larger than " << (getMaxOpenFilesLimit() - RESERVED_OPEN_FILES) / 6 << " due to open files limit. Current open files limit: " << getMaxOpenFilesLimit() << std::endl; return false; } #endif diff --git a/src/test/ovmsconfig_test.cpp b/src/test/ovmsconfig_test.cpp index 7d472ef5ce..959277a2ed 100644 --- a/src/test/ovmsconfig_test.cpp +++ b/src/test/ovmsconfig_test.cpp @@ -208,11 +208,11 @@ TEST_F(OvmsConfigDeathTest, restWorkersTooLarge) { #ifdef __linux__ TEST_F(OvmsConfigDeathTest, restWorkersDefaultReducedForOpenFilesLimit) { - // limit allowed number of open files to 1024 to make sure that rest_workers count is too large for the limit based on number of cpu cores alone + // limit allowed number of open files to value that enforce default rest_workers to be determined based on open files limit instead of number of cpu cores alone. This is to test that default rest_workers count is reduced when open files limit is low. int cpu_cores = ovms::getCoreCount(); struct rlimit limit; ASSERT_EQ(getrlimit(RLIMIT_NOFILE, &limit), 0); - struct rlimit newLimit = {static_cast(cpu_cores * 5), limit.rlim_max}; + struct rlimit newLimit = {std::min(static_cast(cpu_cores * 5), limit.rlim_max), limit.rlim_max}; std::cout << "Setting open files limit to " << newLimit.rlim_cur << " to test that default rest_workers count is reduced based on open files limit" << std::endl; ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &newLimit), 0); @@ -221,7 +221,7 @@ TEST_F(OvmsConfigDeathTest, restWorkersDefaultReducedForOpenFilesLimit) { ovms::Config::instance().parse(arg_count, n_argv); EXPECT_TRUE(ovms::Config::instance().validate()); - ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); + ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); // revert ulimit to original value } TEST_F(OvmsConfigDeathTest, restWorkersTooLargeForOpenFilesLimit) { @@ -233,7 +233,7 @@ TEST_F(OvmsConfigDeathTest, restWorkersTooLargeForOpenFilesLimit) { ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &newLimit), 0); char* n_argv[] = {"ovms", "--config_path", "/path1", "--rest_port", "8080", "--port", "8081", "--rest_workers", "1000"}; int arg_count = 9; - EXPECT_EXIT(ovms::Config::instance().parse(arg_count, n_argv), ::testing::ExitedWithCode(OVMS_EX_USAGE), "rest_workers count cannot be larger than 202 due to open files limit. Current open files limit: 1024"); + EXPECT_EXIT(ovms::Config::instance().parse(arg_count, n_argv), ::testing::ExitedWithCode(OVMS_EX_USAGE), "rest_workers count cannot be larger than 169 due to open files limit. Current open files limit: 1024"); ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); } #endif From f3af31696ada0abb550d17cab7153a526d327217 Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Fri, 3 Apr 2026 14:51:46 +0200 Subject: [PATCH 09/10] style --- src/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config.cpp b/src/config.cpp index 67b9ccde8a..3206777de5 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -69,7 +69,7 @@ uint64_t getDefaultRestWorkers() { if (maxOpenFiles <= RESERVED_OPEN_FILES) { return static_cast(2); // minimum functional number } - return std::min(static_cast(AVAILABLE_CORES), (maxOpenFiles - RESERVED_OPEN_FILES) / 7); // 5x rest_workers to initialize ovms and 2x rest_workers for new connections + return std::min(static_cast(AVAILABLE_CORES), (maxOpenFiles - RESERVED_OPEN_FILES) / 7); // 5x rest_workers to initialize ovms and 2x rest_workers for new connections } #else uint64_t getDefaultRestWorkers() { From d83678c092dda66a4b12413c95ca717fc3cf426f Mon Sep 17 00:00:00 2001 From: Dariusz Trawinski Date: Sat, 4 Apr 2026 01:36:12 +0200 Subject: [PATCH 10/10] unit test --- src/test/ovmsconfig_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/ovmsconfig_test.cpp b/src/test/ovmsconfig_test.cpp index 959277a2ed..e3f2211ab4 100644 --- a/src/test/ovmsconfig_test.cpp +++ b/src/test/ovmsconfig_test.cpp @@ -233,7 +233,7 @@ TEST_F(OvmsConfigDeathTest, restWorkersTooLargeForOpenFilesLimit) { ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &newLimit), 0); char* n_argv[] = {"ovms", "--config_path", "/path1", "--rest_port", "8080", "--port", "8081", "--rest_workers", "1000"}; int arg_count = 9; - EXPECT_EXIT(ovms::Config::instance().parse(arg_count, n_argv), ::testing::ExitedWithCode(OVMS_EX_USAGE), "rest_workers count cannot be larger than 169 due to open files limit. Current open files limit: 1024"); + EXPECT_EXIT(ovms::Config::instance().parse(arg_count, n_argv), ::testing::ExitedWithCode(OVMS_EX_USAGE), "rest_workers count cannot be larger than 168 due to open files limit. Current open files limit: 1024"); ASSERT_EQ(setrlimit(RLIMIT_NOFILE, &limit), 0); } #endif