From a6e22a61f1c66104d4dceb748d476f056fff0470 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 3 Jan 2026 20:40:25 +0000 Subject: [PATCH 1/2] Initial plan From 92669e45cdbd2163015468eb8ee476db133bda16 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 3 Jan 2026 21:01:13 +0000 Subject: [PATCH 2/2] Fix flaky test by setting MinPoolSize to match MaxActiveSessions The test was flaky because MinPoolSize defaulted to 10 while MaxActiveSessions could be set to 1. When the periodic session cleanup task ran, it would check if sessionsCount > MinPoolSize before deleting idle sessions. With the default MinPoolSize of 10 and only 1 session, the condition (1 > 10) was false, so sessions should not be deleted. However, when sessions were removed from the pool for KeepAlive operations and the KeepAlive failed (due to network issues or timeouts during testing), the session could be lost, leading to an empty pool. By explicitly setting MinPoolSize to match MaxActiveSessions, we ensure that sessions are never deleted from the pool due to idle timeout, regardless of KeepAlive success or failure. This makes the test deterministic and prevents the flaky behavior where GetCurrentPoolSize() would sometimes return 0 instead of the expected activeSessionsLimit. Co-authored-by: asmyasnikov <14202262+asmyasnikov@users.noreply.github.com> --- ydb/public/sdk/cpp/tests/integration/sessions_pool/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ydb/public/sdk/cpp/tests/integration/sessions_pool/main.cpp b/ydb/public/sdk/cpp/tests/integration/sessions_pool/main.cpp index 35586965cf1a..47d57edef575 100644 --- a/ydb/public/sdk/cpp/tests/integration/sessions_pool/main.cpp +++ b/ydb/public/sdk/cpp/tests/integration/sessions_pool/main.cpp @@ -19,6 +19,7 @@ class YdbSdkSessionsPool : public ::testing::TestWithParam { auto clientSettings = TClientSettings().SessionPoolSettings( TSessionPoolSettings() .MaxActiveSessions(maxActiveSessions) + .MinPoolSize(maxActiveSessions) .KeepAliveIdleThreshold(TDuration::MilliSeconds(10)) .CloseIdleThreshold(TDuration::MilliSeconds(10))); Client = std::make_unique(*Driver, clientSettings);