Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 3, 2026

Removed executor configurations and added auto config settings.

Changelog entry

The StressTestAsync/0 test was flaky because MinPoolSize defaulted to 10 while MaxActiveSessions was set to 1. Sessions removed for KeepAlive operations (triggered every 10ms by aggressive test thresholds) could be lost on failure, leaving the pool empty despite the sessionsCount > MinPoolSize deletion guard.

Changelog category

  • Not for changelog (changelog entry is not required)

Description for reviewers

...

Changes

Set MinPoolSize to match MaxActiveSessions in test setup:

auto clientSettings = TClientSettings().SessionPoolSettings(
    TSessionPoolSettings()
        .MaxActiveSessions(maxActiveSessions)
        .MinPoolSize(maxActiveSessions)  // Added
        .KeepAliveIdleThreshold(TDuration::MilliSeconds(10))
        .CloseIdleThreshold(TDuration::MilliSeconds(10)));

This prevents session deletion regardless of KeepAlive outcomes, making the test deterministic.

Category

  • Bugfix

Changelog

Fix flaky YdbSdkSessionsPool.StressTestAsync/0 test by setting MinPoolSize equal to MaxActiveSessions, preventing race condition where sessions could be lost during KeepAlive operations.

Original prompt

This section details on the original issue you should resolve

<issue_title>flaky test: ydb/public/sdk/cpp/tests/integration/sessions_pool/YdbSdkSessionsPool.StressTestAsync/0</issue_title>
<issue_description>ydb/public/sdk/cpp/tests/integration/sessions_pool/main.cpp:308:
Expected equality of these values:
Client->GetCurrentPoolSize()
Which is: 0
activeSessionsLimit
Which is: 1</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@github-actions
Copy link

github-actions bot commented Jan 3, 2026

Hi! Thank you for contributing!
The tests on this PR will run after a maintainer adds an ok-to-test label to this PR manually. Thank you for your patience!

@ydbot
Copy link
Collaborator

ydbot commented Jan 3, 2026

Run Extra Tests

Run additional tests for this PR. You can customize:

  • Test Size: small, medium, large (default: all)
  • Test Targets: any directory path (default: ydb/)
  • Sanitizers: ASAN, MSAN, TSAN
  • Coredumps: enable for debugging (default: off)
  • Additional args: custom ya make arguments

▶  Run tests

@github-actions
Copy link

github-actions bot commented Jan 3, 2026

🟢 2026-01-03 21:16:27 UTC The validation of the Pull Request description is successful.

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 <[email protected]>
Copilot AI changed the title [WIP] Fix flaky test in sessions pool for active session limit Fix flaky sessions_pool test by aligning MinPoolSize with MaxActiveSessions Jan 3, 2026
Copilot AI requested a review from asmyasnikov January 3, 2026 21:04
@asmyasnikov asmyasnikov added the ok-to-test Special label used to approve a PR for testing on our infrastructure label Jan 3, 2026
@github-actions github-actions bot removed the ok-to-test Special label used to approve a PR for testing on our infrastructure label Jan 3, 2026
@github-actions
Copy link

github-actions bot commented Jan 3, 2026

2026-01-03 21:10:38 UTC Pre-commit check linux-x86_64-release-asan for 75e00aa has started.
2026-01-03 21:10:55 UTC Artifacts will be uploaded here
2026-01-03 21:13:05 UTC ya make is running...
🟢 2026-01-03 21:18:26 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
22 22 0 0 0 0

🟢 2026-01-03 21:18:32 UTC Build successful.
🟢 2026-01-03 21:18:51 UTC ydbd size 3.8 GiB changed* by +6.1 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: b929c77 merge: 75e00aa diff diff %
ydbd size 4 104 377 800 Bytes 4 104 384 000 Bytes +6.1 KiB +0.000%
ydbd stripped size 1 535 378 448 Bytes 1 535 381 040 Bytes +2.5 KiB +0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Jan 3, 2026

2026-01-03 21:11:21 UTC Pre-commit check linux-x86_64-relwithdebinfo for 75e00aa has started.
2026-01-03 21:11:37 UTC Artifacts will be uploaded here
2026-01-03 21:13:43 UTC ya make is running...
🟢 2026-01-03 21:18:43 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
22 22 0 0 0 0

🟢 2026-01-03 21:18:49 UTC Build successful.
🟢 2026-01-03 21:19:04 UTC ydbd size 2.3 GiB changed* by +2.4 KiB, which is < 100.0 KiB vs main: OK

ydbd size dash main: b929c77 merge: 75e00aa diff diff %
ydbd size 2 495 880 832 Bytes 2 495 883 312 Bytes +2.4 KiB +0.000%
ydbd stripped size 530 644 416 Bytes 530 644 992 Bytes +576 Bytes +0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@asmyasnikov asmyasnikov marked this pull request as ready for review January 9, 2026 12:53
@asmyasnikov asmyasnikov requested a review from a team as a code owner January 9, 2026 12:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a flaky test (YdbSdkSessionsPool.StressTestAsync/0) by aligning the MinPoolSize session pool setting with MaxActiveSessions to prevent sessions from being deleted during aggressive KeepAlive operations.

Key Changes

  • Set MinPoolSize equal to MaxActiveSessions in the test's SetUp() method to ensure session pool stability during stress testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@asmyasnikov asmyasnikov added the ok-to-test Special label used to approve a PR for testing on our infrastructure label Jan 13, 2026
@github-actions github-actions bot removed the ok-to-test Special label used to approve a PR for testing on our infrastructure label Jan 13, 2026
@github-actions
Copy link

github-actions bot commented Jan 13, 2026

2026-01-13 04:40:36 UTC Pre-commit check linux-x86_64-relwithdebinfo for b0f7a28 has started.
2026-01-13 04:40:53 UTC Artifacts will be uploaded here
2026-01-13 04:43:07 UTC ya make is running...
🟢 2026-01-13 04:48:14 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
22 22 0 0 0 0

🟢 2026-01-13 04:48:22 UTC Build successful.
🟢 2026-01-13 04:48:37 UTC ydbd size 2.3 GiB changed* by 0 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: afdd375 merge: b0f7a28 diff diff %
ydbd size 2 495 089 776 Bytes 2 495 089 776 Bytes 0 Bytes 0.000%
ydbd stripped size 530 796 928 Bytes 530 796 928 Bytes 0 Bytes 0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

@github-actions
Copy link

github-actions bot commented Jan 13, 2026

2026-01-13 04:40:38 UTC Pre-commit check linux-x86_64-release-asan for b0f7a28 has started.
2026-01-13 04:40:54 UTC Artifacts will be uploaded here
2026-01-13 04:43:01 UTC ya make is running...
🟢 2026-01-13 04:48:15 UTC Tests successful.

Ya make output | Test bloat

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
22 22 0 0 0 0

🟢 2026-01-13 04:48:21 UTC Build successful.
🟢 2026-01-13 04:48:39 UTC ydbd size 3.8 GiB changed* by -96 Bytes, which is <= 0 Bytes vs main: OK

ydbd size dash main: afdd375 merge: b0f7a28 diff diff %
ydbd size 4 102 547 728 Bytes 4 102 547 632 Bytes -96 Bytes -0.000%
ydbd stripped size 1 535 806 384 Bytes 1 535 806 320 Bytes -64 Bytes -0.000%

*please be aware that the difference is based on comparing your commit and the last completed build from the post-commit, check comparation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure in ydb/public/sdk/cpp/tests/integration/sessions_pool/YdbSdkSessionsPool.StressTestAsync/0

3 participants