Skip to content

Do not rethrow from SocketsTestServerAPM.OnAccept #114964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

rzikm
Copy link
Member

@rzikm rzikm commented Apr 23, 2025

Fixes #85666.

The test class spawns a recursive OnAccept method which uses Begin/End pattern to continue accepting connections until the server is disposed. There is a condition which allows SocketException with SocketError.InvalidArgument to be thrown out of the function which leads to test process crash.

Since any sort of exception would crash the process, this PR simplifies the logic by removing any rethrows.

@rzikm rzikm requested a review from antonfirsov April 23, 2025 16:35
@rzikm rzikm marked this pull request as ready for review April 23, 2025 16:35
@Copilot Copilot AI review requested due to automatic review settings April 23, 2025 16:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issue #85666 by preventing rethrows in the SocketTestServerAPM.OnAccept method to avoid test process crashes.

  • Removed rethrows from two SocketException catch blocks
  • Simplified exception handling to ensure the recursive OnAccept loop exits gracefully
Comments suppressed due to low confidence (2)

src/libraries/Common/tests/System/Net/Sockets/SocketTestServerAPM.cs:54

  • Consider adding a comment in this catch block to explain that swallowing the exception is intentional to prevent process crashes during continuous accepts.
throw;

src/libraries/Common/tests/System/Net/Sockets/SocketTestServerAPM.cs:78

  • Consider adding a comment in this catch block to clarify that omitting the rethrow is intentional as part of the fix for test process crashes.
throw;

@rzikm
Copy link
Member Author

rzikm commented Apr 25, 2025

/ba-g test failure is #115006

@rzikm rzikm merged commit 5d42918 into dotnet:main Apr 25, 2025
81 of 85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Occasional crashes in System.Net.Sockets.Tests on Alpine 3.15
3 participants