Skip to content

Test failure: SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds fails intermittently on Linux #133012

Description

@rzikm

Test failure

System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds is failing intermittently on Linux (Ubuntu.2604.Amd64.Open, Alpine.324.Amd64.Open, Alpine.Edge.Amd64.Open, AzureLinux.3.0.ArmArch.Open, Alpine.324.Arm64.Open) in the inner loop across the runtime, runtime-coreclr crossgen2, and runtime-nativeaot-outerloop pipelines.

Error message

Assert.False() Failure
Expected: False
Actual:   True

Stack trace:

at System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds() in /_/src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.Unix.cs:line 230

Frequency

11 builds on main plus ~34 PR runs over the past 14 days, exclusively on Linux queues. Ongoing since 2026-08-19.

Analysis

The failing assertion is at Connect.Unix.cs:230:

src/libraries/System.Net.Sockets/tests/FunctionalTests/Connect.Unix.cs

bool completedAsync = client.ConnectAsync(saea);
if (!completedAsync)
{
    tcs.SetResult();
}

await tcs.Task;

Assert.Equal(SocketError.Success, saea.SocketError);
Assert.True(client.Blocking);

// On Apple and Android platforms, TFO (connectx/sendto) may complete the connect+send
// in a single syscall, so the socket can end up blocking even on the async path.
// On Linux, async connect always leaves the socket non-blocking when
// buffer > 0 because SendToAsync is pending.
if (!completedAsync || PlatformDetection.IsApplePlatform || PlatformDetection.IsAndroid)
{
    Assert.False(IsSocketNonBlocking(client));   // <-- line 230
}
else
{
    Assert.True(IsSocketNonBlocking(client));
}

On loopback the ConnectAsync(saea) with a send buffer can complete synchronously (completedAsync == false). The test then takes the line-230 branch and asserts the socket has been restored to blocking mode (IsSocketNonBlocking == False). Intermittently the socket is still non-blocking (Actual: True), because a pending async send left over from the connect+send path keeps the descriptor in non-blocking mode.

In other words, the test's assumption that a synchronously-completing ConnectAsync + buffer always restores blocking mode does not hold on Linux loopback: the sync-vs-async classification races with whether the underlying SendToAsync is still pending. This looks like a test-logic race (the !completedAsync branch is not a reliable proxy for "the socket has been restored to blocking mode"), though it may also point at a blocking-mode-restore gap in the sync-completion path.

Suggested fix

Make the blocking-mode assertion tolerant of the sync-completion-with-pending-send case on Linux (e.g. only assert blocking mode when there is genuinely no pending send), or restore blocking mode deterministically before completing the synchronous connect+send path. Until then, filing a Known Build Error so Build Analysis can auto-match this failure.

Sample console log

https://helixr1107v0xdcypoyl9e7f.blob.core.windows.net/dotnet-runtime-refs-heads-main-986da17b21c84d32af/System.Net.Sockets.Tests/1/console.063f084e.log?helixlogtype=result

Known issue error message

Fill the error message using known issues.

{
  "ErrorPattern": "System\\.Net\\.Sockets\\.Tests\\.SocketBlockingModeTransitionTests\\.ConnectAsync_WithBuffer_Succeeds",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=1575764
Error message validated: [System\.Net\.Sockets\.Tests\.SocketBlockingModeTransitionTests\.ConnectAsync_WithBuffer_Succeeds]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 9/1/2026 1:14:11 PM UTC

Report

Build Repository Test Pull Request
1592628 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133692
1592552 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133654
1592471 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133595
1592363 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133637
1592345 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133599
1592299 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1592289 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133606
1592296 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1592269 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133413
1592056 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133662
1592043 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133658
1592045 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133659
1592042 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1591805 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133649
1591749 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132115
1591617 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1591587 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131589
1591467 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133628
1591389 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133188
1591446 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133570
1591427 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #130050
1591277 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131701
1591182 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1591273 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132115
1591177 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1591044 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133570
1591040 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133496
1591013 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133602
1590905 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #130407
1590908 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132456
1590840 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133593
1590813 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131597
1590378 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133573
1590364 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133571
1590252 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133568
1590235 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133471
1590217 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132953
1590198 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131461
1590019 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1589972 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1589690 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133413
1589591 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133450
1589510 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1589542 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133430
1589360 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133188
1589291 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132744
1589278 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132827
1589218 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1589092 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133501
1589052 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #130407
1589069 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133378
1589020 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133496
1588962 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1588922 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132456
1588917 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132517
1588604 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133475
1588519 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133463
1588443 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133471
1588425 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1588153 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133424
1588090 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133457
1588022 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133453
1587919 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1587780 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133439
1587751 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133116
1587711 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133430
1587703 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133275
1587559 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133427
1587454 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133424
1587461 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132584
1587421 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131869
1587408 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #125901
1587371 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133378
1587232 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131995
1587058 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133409
1586898 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1586993 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133381
1586932 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133406
1586870 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133404
1586665 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133394
1586642 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1586491 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #130050
1586369 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133341
1586294 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133371
1586185 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133368
1586067 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132819
1586031 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133360
1585887 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #128981
1585909 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131794
1585516 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1585395 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133340
1585392 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1585094 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133333
1584978 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1584957 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #130050
1584938 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133322
1584749 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1584620 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133265
1584493 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133309
1584461 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133308
Displaying 100 of 204 results

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
25 110 204

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Known Build ErrorUse this to report build issues in the .NET Helix tabarea-System.Net.Socketsblocking-clean-ciBlocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms'

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions