Skip to content

Run the blocking parts of the rotation race test on dedicated threads - #809

Merged
Sev7eNup merged 1 commit into
mainfrom
test/rotation-test-dedicated-threads
Nov 5, 2026
Merged

Sev7eNup merged 1 commit into
mainfrom
test/rotation-test-dedicated-threads

Conversation

@Sev7eNup

@Sev7eNup Sev7eNup commented Nov 5, 2026

Copy link
Copy Markdown
Owner

RuntimeOverridesSecretRotationTests.Rotation_ConcurrentSettingsSaveWaits_ThenUsesResealedDocumentAndBackup failed three times today, on #807 and twice on #808, each time with TimeoutException: test barrier after 10 s. Main passed the same test in between.

The test parks the rotation inside a mocked Unprotect until the concurrent save has started. Both the rotation and the save were started with Task.Run, so the save needs a second thread-pool thread while the first one is blocked. On a busy runner the pool can take longer than the 10 s barrier to grow. The rotation then throws "test barrier", which also hides the assertion in the finally. Today's other backend flakes are timing failures as well, on a waitAny elapsed bound and a 1 s FileWatcher deadline, which fits a loaded runner.

The fix runs both blocking parts on dedicated threads (TaskCreationOptions.LongRunning). The test no longer depends on thread-pool growth, and there are no sleeps or longer timeouts.

I could not reproduce the starvation locally. DOTNET_ThreadPool_ForceMaxWorkerThreads had no effect on .NET 10, and both versions passed with it.

Tests run locally:

  • NodePilot.Api.Tests with filter RuntimeOverridesSecretRotationTests, 5 runs (4 tests each)

🤖 Generated with Claude Code

The test parks the rotation inside Unprotect and then needs a second
thread for the concurrent save. Both ran on the thread pool, so a busy
runner could leave the save unscheduled for the full 10 s barrier and
the test failed with "test barrier". Dedicated threads remove the
dependency on thread-pool growth.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Sev7eNup
Sev7eNup merged commit effe3a9 into main Nov 5, 2026
17 checks passed
@Sev7eNup
Sev7eNup deleted the test/rotation-test-dedicated-threads branch November 5, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant