Repository navigation
Fix TcpSpec.Outgoing_TCP_stream_must_shut_down_both_streams_when_connection_is_aborted_remotely race condition on Linux - #7815
Merged
Aaronontheweb merged 2 commits intoSep 9, 2025
Conversation
The test 'Outgoing_TCP_stream_must_shut_down_both_streams_when_connection_is_aborted_remotely' was failing intermittently on Linux due to platform-specific TCP behavior. Root cause: - Linux requires active recv() calls to detect TCP RST during connection establishment - Test was creating "zombie" connections (established but not actively reading) - When abort happened before active reading, RST detection failed on Linux - Windows worked fine due to more aggressive RST detection Solution: 1. Wait for TCP connection to be fully established using ViaMaterialized 2. Start active reading with readSub.Request(1) to trigger recv() on Linux 3. Then abort - ensuring RST detection works reliably across platforms This makes the test behave like real applications that immediately start using their TCP connections, which is why real apps don't have this issue. Fixes the race condition that caused 11 failed attempts in PR akkadotnet#7813.
TcpSpec.Outgoing_TCP_stream_must_shut_down_both_streams_when_connection_is_aborted_remotely race condition on Linux
Aaronontheweb
enabled auto-merge (squash)
September 9, 2025 17:32
Aaronontheweb
disabled auto-merge
September 9, 2025 17:32
Aaronontheweb
enabled auto-merge (squash)
September 9, 2025 17:33
Aaronontheweb
added a commit
that referenced
this pull request
Jul 2, 2026
The test 'Outgoing_TCP_stream_must_shut_down_both_streams_when_connection_is_aborted_remotely' was failing intermittently on Linux due to platform-specific TCP behavior. Root cause: - Linux requires active recv() calls to detect TCP RST during connection establishment - Test was creating "zombie" connections (established but not actively reading) - When abort happened before active reading, RST detection failed on Linux - Windows worked fine due to more aggressive RST detection Solution: 1. Wait for TCP connection to be fully established using ViaMaterialized 2. Start active reading with readSub.Request(1) to trigger recv() on Linux 3. Then abort - ensuring RST detection works reliably across platforms This makes the test behave like real applications that immediately start using their TCP connections, which is why real apps don't have this issue. Fixes the race condition that caused 11 failed attempts in PR #7813. (cherry picked from commit 6aee8bd)
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
The test
Outgoing_TCP_stream_must_shut_down_both_streams_when_connection_is_aborted_remotelywas failing intermittently on Linux due to platform-specific TCP behavior. This issue caused 11 failed attempts in PR #7813.Root Cause
Linux requires active recv() calls to detect TCP RST during connection establishment.
Solution
ViaMaterialized(..., Keep.Right)to ensure connection is fully readyreadSub.Request(1)to triggerrecv()calls on LinuxThis makes the test behave like real applications that immediately start using their TCP connections.
Testing
Files Changed
src/core/Akka.Streams.Tests/IO/TcpSpec.cs- Updated test to wait for connection and start readingCloses #7813