Skip to content

Commit a769397

Browse files
Fix race condition in FlowPrefixAndTailSpec double materialization test (#7816)
The test `PrefixAndTail_must_throw_if_tail_is_attempted_to_be_materialized_twice` was failing intermittently with "Expected OnError but received OnNext(2)". Root cause: Even after PR #7796 fixed the atomic detection of double materialization, there was still a timing race between error detection and demand signaling from ExpectSubscriptionAndError(). Fix: Disable demand signaling in the second subscriber's error expectation by using `ExpectSubscriptionAndError(signalDemand: false)`. This eliminates the race window while preserving the test's intent to verify error handling. The test now passes consistently without requiring changes to production code.
1 parent 6aee8bd commit a769397

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/Akka.Streams.Tests/Dsl/FlowPrefixAndTailSpec.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ await this.AssertAllStagesStoppedAsync(async() => {
153153
var subscriber2 = this.CreateSubscriberProbe<int>();
154154
tail.To(Sink.FromSubscriber(subscriber2)).Run(Materializer);
155155

156-
subscriber2.ExpectSubscriptionAndError()
156+
subscriber2.ExpectSubscriptionAndError(signalDemand: false)
157157
.Message.Should()
158158
.Be("Substream Source cannot be materialized more than once");
159159
await subscriber1.RequestNext(2).ExpectCompleteAsync();

0 commit comments

Comments
 (0)