Skip to content

fix: resolve TestKit startup timeout race condition#705

Merged
Aaronontheweb merged 2 commits intoakkadotnet:devfrom
Aaronontheweb:fix/testkit-startup-timeout-race
Jan 26, 2026
Merged

fix: resolve TestKit startup timeout race condition#705
Aaronontheweb merged 2 commits intoakkadotnet:devfrom
Aaronontheweb:fix/testkit-startup-timeout-race

Conversation

@Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Jan 26, 2026

Summary

  • Fixed race condition in TestKit.InitializeAsync() where CancellationTokenSource.Register() threw exceptions on the timer thread, causing unhandled exceptions that crashed the test host process
  • Properly handle timeout using OperationCanceledException and Task.WhenAny
  • Increased default startup timeout from 10s to 30s for CI environments

Test plan

  • Verify TestKit tests pass on Windows CI
  • Verify TestKit tests pass on Linux CI

The previous implementation used CancellationTokenSource.Register() to
throw a TimeoutException, but this threw on the timer thread rather than
the async context, causing an unhandled exception that crashed the test
host process.

This fix:
- Properly catches OperationCanceledException and converts to TimeoutException
- Uses Task.WhenAny to timeout the Akka initialization wait
- Increases default timeout from 10s to 30s for CI environments
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) January 26, 2026 23:02
@Aaronontheweb Aaronontheweb merged commit 903a8ad into akkadotnet:dev Jan 26, 2026
2 checks passed
This was referenced Feb 27, 2026
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