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
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
1584442 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #130050
1584429 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133265
1584226 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1584218 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133289
1583901 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133275
1583662 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1583519 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133254
1583367 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133249
1583343 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132908
1583332 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133115
1583276 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131931
1583284 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133244
1583242 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133239
1583196 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1583193 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1583172 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132419
1583095 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131931
1583028 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133159
1582982 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #128981
1582560 dotnet/runtime System.Net.Sockets.Tests.ReceiveFrom_Apm.BeginReceiveFrom_RemoteEpIsReturnedWhenCompletedSynchronously
1582740 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133174
1582722 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131877
1582681 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131931
1582616 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133227
1582322 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds
1582310 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133173
1582265 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133192
1582067 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133200
1581946 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #130050
1581811 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #132861
1581623 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #131877
1581535 dotnet/runtime System.Net.Sockets.Tests.SocketBlockingModeTransitionTests.ConnectAsync_WithBuffer_Succeeds #133192
Displaying 100 of 172 results

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
23 110 172

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