This is an automated email from the ASF dual-hosted git repository.
NSAmelchev pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 79c30861ca6 IGNITE-29130 Fix flaky IgniteClientUserThreadPoolSize test
of the C++ thin client (#13678)
79c30861ca6 is described below
commit 79c30861ca67dda626fbd321f582f4588b1a2a6e
Author: Nikita Amelchev <[email protected]>
AuthorDate: Mon Oct 12 18:41:12 2026 +0300
IGNITE-29130 Fix flaky IgniteClientUserThreadPoolSize test of the C++ thin
client (#13678)
---
.../thin-client-test/src/ignite_client_test.cpp | 30 ++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/modules/platforms/cpp/thin-client-test/src/ignite_client_test.cpp
b/modules/platforms/cpp/thin-client-test/src/ignite_client_test.cpp
index 05ce4fb0707..61b53cd87c6 100644
--- a/modules/platforms/cpp/thin-client-test/src/ignite_client_test.cpp
+++ b/modules/platforms/cpp/thin-client-test/src/ignite_client_test.cpp
@@ -72,6 +72,32 @@ public:
BOOST_CHECK_EQUAL(GetActiveConnections(), expect);
}
+
+ /**
+ * Get the number of threads once it stops changing: a joined thread is
still listed in the process for a while,
+ * and the in-process JVM started by other tests creates and stops its own
threads.
+ *
+ * @return Number of threads.
+ */
+ static int32_t GetSettledThreadsCount()
+ {
+ int32_t cnt = ignite::common::concurrent::GetThreadsCount();
+
+ for (int i = 0; i < 25; ++i)
+ {
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(200));
+
+ int32_t cnt0 = ignite::common::concurrent::GetThreadsCount();
+
+ if (cnt0 == cnt)
+ break;
+
+ cnt = cnt0;
+ }
+
+ return cnt;
+ }
+
/**
* Check that client started with specified size of user thread pool
started exactly the specified number of threads
* in thread pool.
@@ -85,7 +111,7 @@ public:
server.PushHandshakeResponse(true);
server.Start();
- int32_t threadsBefore = ignite::common::concurrent::GetThreadsCount();
+ int32_t threadsBefore = GetSettledThreadsCount();
int32_t netThreads = 1;
#ifdef _WIN32
@@ -103,7 +129,7 @@ public:
BOOST_CHECK_EQUAL(threadsExpected, threadsActual);
}
- int32_t threadsAfter = ignite::common::concurrent::GetThreadsCount();
+ int32_t threadsAfter = GetSettledThreadsCount();
BOOST_CHECK_EQUAL(threadsBefore, threadsAfter);
BOOST_CHECK_EQUAL(num, cfg.GetUserThreadPoolSize());