Skip to content

[✨ Triage] dotnet/runtime#122493 by matouskozak - SocketException 'Connection reset by peer' causing test failures o ... #54

@MihuBot

Description

@MihuBot

Triage for dotnet/runtime#122493.
Repo filter: All networking issues.
MihuBot version: 617ebc.
Ping MihaZupan for any issues.

This is a test triage report generated by AI, aimed at helping the triage team quickly identify past issues/PRs that may be related.
Take any conclusions with a large grain of salt.

Tool logs
dotnet/runtime#122493: SocketException 'Connection reset by peer' causing test failures on android_arm64 and android_x64 by matouskozak
[Tool] Searching for SocketException Connection reset by peer android, System.Net.Sockets.Tests.WorkItemExecution, System.Net.Sockets.SocketException : Connection reset by peer, android_arm64_Release_NativeAOT, android_x64_Release_NativeAOT (IncludeOpen=True, IncludeClosed=True, IncludeIssues=True, IncludePullRequests=False, Repository=dotnet/runtime)
[Tool] Searching for System.Net.Sockets.Tests.ConnectSyncForceNonBlocking.MultiConnect_LingerState_Preserved, System.Net.Sockets.Tests.ArgumentValidation.SelectPoll_InfiniteTimeSpan_Ok, System.Net.Sockets.Tests.ConnectTask.MultiConnect_MiscProperties_Preserved, System.Net.Sockets.Tests.ConnectCancellableTask.Connect_ExposeHandle_FirstAttemptSucceeds (IncludeOpen=True, IncludeClosed=True, IncludeIssues=True, IncludePullRequests=False, Repository=dotnet/runtime)
[Tool] Searching for NativeAOT android socket test failure, connection reset by peer test failure, System.Net.Sockets area (IncludeOpen=True, IncludeClosed=True, IncludeIssues=True, IncludePullRequests=False, Repository=dotnet/runtime)
[Tool] Found 40 issues, 12 comments (18427 ms)
[Tool] Found 28 issues, 27 comments (18699 ms)
[Tool] Found 40 issues, 59 comments (22439 ms)

Here is a list of related issues and discussions relevant to the test failures in issue #122493 ("SocketException 'Connection reset by peer' causing test failures on android_arm64 and android_x64"):


1. [Issue #121717 (Nov 2025) - naot][android] Test failure in ArgumentValidation.SelectPoll_InfiniteTimeSpan_Ok

  • Summary: Reports the same test (System.Net.Sockets.Tests.ArgumentValidation.SelectPoll_InfiniteTimeSpan_Ok) failing with System.Net.Sockets.SocketException : Connection reset by peer 127.0.0.1:42689 on Android NativeAOT.
  • Discussion: No deep investigation, but this is a direct match to one of the failures in #122493, confirming this is not an isolated incident.

2. Issue #50568 (Apr 2021) - System.Net.Sockets.Tests fails on Android

  • Summary: Several System.Net.Sockets.Tests fail on Android, including tests involving socket cancellation and Unix domain sockets.
  • Discussion: Lists a variety of socket test failures, some of which are related to connection resets or cancellation, but not all are the same as in #122493. Shows a history of socket test instability on Android.

3. Issue #114450 (Apr 2025) - HOW TO build Microsoft.NETCore.App.Runtime.NativeAOT.linux-bionic-arm64?

  • Summary: Not directly about test failures, but referenced as a known issue in the triage template. Indicates ongoing work and interest in NativeAOT for ARM64/Android, which is the context for the failures in #122493.

4. Issue #120526 (Sep 2025) - NativeAOT for Android + MAUI

  • Summary: Tracks NativeAOT support for Android and MAUI, including test and CI coverage. This is referenced as a known issue in the triage template, showing that NativeAOT on Android is still in flux and may have test instability.

5. Issue #90521 (Aug 2023) - System.Net.Sockets.Tests failing in CI runs

  • Summary: Reports failures in System.Net.Sockets.Tests.WorkItemExecution (the same test suite as in #122493), but with a different error (Timeout waiting for client connection). Shows that this test suite is historically flaky.

Other Socket "Connection reset by peer" Issues (General/Non-Android)

6. Issue #95516 (Dec 2023) - Connection reset by peer error when sending requests using HttpClient

  • Summary: Reports intermittent SocketException: Connection reset by peer in .NET 6 HttpClient usage. The discussion confirms this error means the server closed the TCP connection with RST, and suggests packet capture for diagnosis.
  • Discussion: The .NET networking team explains that this is typically a server/network issue, not a .NET bug, and can be caused by idle timeouts or network equipment.

7. Issue #84138 (Mar 2023) - HttpClient call is giving 104 connection reset by peer after migrating to .net 6.0

  • Summary: After migrating to .NET 6, users see connection reset by peer errors. The discussion again points to network/server-side causes and the need for packet captures.

8. Issue #86893 (May 2023) - Error: Unable to read data from the transport connection: Connection reset by peer when using Httpclient in Dotnet core api

  • Summary: Intermittent connection resets in HttpClient calls, especially in cloud environments. The .NET team suggests packet captures and notes that this is usually a server or network issue.

Android/NativeAOT/Socket Test Instability and Platform Issues

9. Issue #106748 (Aug 2024) - NativeAOT status for Android

  • Summary: Long discussion about the state of NativeAOT on Android, including test failures, performance, and platform support. Multiple comments reference test instability and the need for more robust CI/test coverage.
  • Discussion: Several users report test failures and instability, including socket-related issues, when running NativeAOT on Android. The .NET team acknowledges ongoing work and the experimental nature of the platform.

10. Issue #96592 (Jan 2024) - AOT built binary for aarch64 android fails to run on Nvidia Shield TV

  • Summary: Not directly about sockets, but shows that NativeAOT on Android/ARM64 is still being actively developed and may have platform-specific issues.

11. Issue #108421 (Oct 2024) - TCP Socket - Connection reset while receiving data

  • Summary: Reports connection resets when receiving bulk data on Android with .NET 8, which worked in Xamarin. The discussion suggests buffer size or platform differences may be at play.

Test Flakiness and Infrastructure Issues

12. Issue #122503 (Dec 2025) - Test execution timeout in System.Collections.Concurrent.WorkItemExecution on Android NativeAOT

  • Summary: Reports timeouts (not connection resets) in Android NativeAOT CI jobs, showing that test infrastructure and reliability are ongoing challenges for this platform.

13. Issue #35065 (Apr 2020) - System.Net.Sockets.Tests failing as a group in CI

  • Summary: Reports group failures in socket tests, sometimes due to network configuration or test environment issues.

Additional Notes

  • The error System.Net.Sockets.SocketException : Connection reset by peer is a generic TCP error indicating the remote side (or the OS) closed the connection with a TCP RST. This can be caused by test environment flakiness, platform-specific socket stack differences, or actual bugs in the test or product code.
  • Many of the above issues (especially those for Android/NativeAOT) indicate that test instability is expected and ongoing as support for these platforms matures.
  • The referenced known issues in the triage template for #122493 (#120526, #114450) are tracking overall NativeAOT/Android support and test coverage.

Summary Table

Issue # Date Title Key Points
#121717 Nov 2025 [naot][android] Test failure in ArgumentValidation.SelectPoll_InfiniteTimeSpan_Ok Direct match to one of the failing tests in #122493
#50568 Apr 2021 System.Net.Sockets.Tests fails on Android General Android socket test instability
#114450 Apr 2025 HOW TO build Microsoft.NETCore.App.Runtime.NativeAOT.linux-bionic-arm64? NativeAOT/Android support tracking
#120526 Sep 2025 NativeAOT for Android + MAUI NativeAOT/Android support tracking
#90521 Aug 2023 System.Net.Sockets.Tests failing in CI runs Same test suite, different error (timeout)
#95516 Dec 2023 Connection reset by peer error when sending requests using HttpClient General TCP RST error, usually network/server issue
#84138 Mar 2023 HttpClient call is giving 104 connection reset by peer after migrating to .net 6.0 General TCP RST error, usually network/server issue
#86893 May 2023 Error: Unable to read data from the transport connection: Connection reset by peer General TCP RST error, usually network/server issue
#106748 Aug 2024 NativeAOT status for Android Ongoing platform/test instability, including sockets
#96592 Jan 2024 AOT built binary for aarch64 android fails to run on Nvidia Shield TV NativeAOT/Android platform issues
#108421 Oct 2024 TCP Socket - Connection reset while receiving data Android socket connection resets, buffer size issues
#122503 Dec 2025 Test execution timeout in System.Collections.Concurrent.WorkItemExecution on Android NativeAOT Test infrastructure flakiness on Android NativeAOT
#35065 Apr 2020 System.Net.Sockets.Tests failing as a group in CI Group socket test failures, sometimes infra-related

Conclusion

  • The failures in #122493 are part of a broader pattern of socket test instability on Android NativeAOT, especially with connection resets.
  • There are directly matching issues (notably #121717) and several tracking issues for NativeAOT/Android support.
  • The error is not unique to .NET or Android, but is exacerbated by the relative immaturity of NativeAOT/Android support and test infrastructure.
  • No single root cause is identified; these are likely a mix of platform differences, test flakiness, and possibly product bugs.

If you are triaging #122493, it is appropriate to link it to #121717, #50568, #120526, and #114450 as related/known issues, and to note that socket test instability is expected on Android NativeAOT at this time.


Let me know if you need a more focused summary or further details on any of the above issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions