Fix double-dilated timeout in ExpectMsgAsync<T>(Func<T, IActorRef, bool>, ...) - #8430
Merged
Aaronontheweb merged 1 commit intoJul 29, 2026
Conversation
…ol>, ...) This overload resolved its bound as RemainingOrDilated(RemainingOrDilated(timeout)), applying akka.test.timefactor twice. Every sibling overload applies it once. With timefactor = 3 an explicit 5s wait became 45s. The null case is worse: the inner call resolves to RemainingOrDefault - the time actually left in the enclosing Within - and the outer call then dilates that, producing a bound larger than the remaining budget it was derived from. Apply RemainingOrDilated once, matching every other overload. No in-repo caller uses this overload, so nothing here was relying on the inflated bound; Akka.TestKit.Tests (320) and Akka.TestKit.Xunit2.Tests (4) pass.
Aaronontheweb
added a commit
to Aaronontheweb/akka.net
that referenced
this pull request
Jul 31, 2026
…data + double-dilate fix
Aaronontheweb
added a commit
that referenced
this pull request
Aug 11, 2026
…ol>, ...) (#8430) This overload resolved its bound as RemainingOrDilated(RemainingOrDilated(timeout)), applying akka.test.timefactor twice. Every sibling overload applies it once. With timefactor = 3 an explicit 5s wait became 45s. The null case is worse: the inner call resolves to RemainingOrDefault - the time actually left in the enclosing Within - and the outer call then dilates that, producing a bound larger than the remaining budget it was derived from. Apply RemainingOrDilated once, matching every other overload. No in-repo caller uses this overload, so nothing here was relying on the inflated bound; Akka.TestKit.Tests (320) and Akka.TestKit.Xunit2.Tests (4) pass.
This was referenced Aug 27, 2026
Closed
This was referenced Aug 30, 2026
Closed
This was referenced Sep 9, 2026
This was referenced Sep 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
TestKitBase_Expect.cs:207resolves its timeout as:applying
akka.test.timefactortwice. Every sibling overload applies it once.Two consequences:
timefactor = 3, a 5s wait becomes 45s (5 → 15 → 45).nullit is worse than a simple over-scale: the inner call resolves toRemainingOrDefault— the time actually remaining in the enclosingWithin— and the outer call then dilates that remainder, yielding a bound larger than the budget it was derived from.Found while tracking down MNTR flakes caused by the same class of mistake in test code (pre-dilating a value handed to a TestKit method that dilates internally).
Fix
Apply
RemainingOrDilatedonce, matching every other overload.Blast radius
This overload —
ExpectMsgAsync<T>(Func<T, IActorRef, bool> isMessageAndSender, ...)— has no callers anywhere in this repository, so no existing test was relying on the inflated bound. It affects downstream users ofAkka.TestKitonly, for whom this restores the documentedtimefactorsemantics.Note the effective timeout gets shorter for anyone using this overload with a large
timefactor, which is the correct behaviour but is a behavioural change worth calling out in review.Verification
Akka.TestKit.Tests320/321 (1 pre-existing skip) andAkka.TestKit.Xunit2.Tests4/4 pass.