Skip to content

Change SocketException to ServerNotAvailable + misc test fixes/logging - #5354

Merged
noahfalk merged 3 commits into
dotnet:mainfrom
noahfalk:add_counter_test_logging
Jul 14, 2025
Merged

noahfalk merged 3 commits into
dotnet:mainfrom
noahfalk:add_counter_test_logging

Conversation

@noahfalk

@noahfalk noahfalk commented Mar 18, 2025 •

Copy link
Copy Markdown
Member

This started out as a bit of test logging. Then the unrelated GetProcessInfo test failed in CI so the change grew into a small product fix + more test improvements.

Product changes:

  • Connecting to the IPC channel might fail when the runtime is starting up, shutting down, or is overloaded. If so the socket.Connect() call is going to throw a SocketException. In order to avoid having callers to DiagnosticClient APIs understand all the implrementation details and have to use catch clauses for a wide variety of different exceptions we now catch this exception and rethrow it wrapped as a ServerNotAvailableException.

Test changes:

  • Add logging to the DuplicateMetricNames test to improve diagnostics when it hangs.
  • Add retries to the GetProcessInfo requests that are running while the target process is starting up. There is no guarantee the runtime is listening to the socket at this point and connection requests may be refused. This may resolve one cause of flakiness noted in BasicProcessInfoNoSuspendTest and BasicProcessInfoNoSuspendTestAsync are flaky #2760. The issue also shows a 'ReadPastEndOfStream' problem that is not addressed by this fix.
  • Add verification that the ExePath returned by DebuggeeCompiler actually exists on disk. This catches some build/config issues in the test setup more eagerly.
  • Add verification that the BuildProjectFramework and TargetConfiguration used by SdkPrebuiltDebuggeeCompiler are populated. This catches some specific test configuration errors more eagerly.
  • Tweaked some out-of-date comments

Trying to diagnose why the test isn't completing and the issue isn't reproing locally.
@noahfalk
noahfalk requested a review from a team as a code owner March 18, 2025 07:19
Product changes:
- Connecting to the IPC channel might fail when the runtime is starting up, shutting down, or is overloaded. If so the socket.Connect() call is going to throw a SocketException. In order to avoid having callers to DiagnosticClient APIs understand all the implrementation details and have to use catch clauses for a wide variety of different exceptions we now catch this exception and rethrow it wrapped as a ServerNotAvailableException.

Test changes:
- Add retries to the GetProcessInfo requests that are running while the target process is starting up. There is no guarantee the runtime is listening to the socket at this point and connection requests may be refused. This may resolve one cause of flakiness noted in dotnet#2760. The issue also shows a 'ReadPastEndOfStream' problem that is not addressed by this fix.
- Add verification that the ExePath returned by DebuggeeCompiler actually exists on disk. This catches some build/config issues in the test setup more eagerly.
- Add verification that the BuildProjectFramework and TargetConfiguration used by SdkPrebuiltDebuggeeCompiler are populated. This catches some specific test configuration errors more eagerly.
- Tweaked some out-of-date comments
@noahfalk noahfalk changed the title Add some logging the DuplicateMetricName test Change SocketException to ServerNotAvailable + misc test fixes/logging Mar 19, 2025
@noahfalk

Copy link
Copy Markdown
Member Author

PTAL @dotnet/dotnet-diag

mdh1418
mdh1418 previously approved these changes Mar 19, 2025
hoyosjs
hoyosjs previously approved these changes Mar 19, 2025
@steveisok

Copy link
Copy Markdown
Member

@noahfalk still good to merge?

@noahfalk
noahfalk dismissed stale reviews from hoyosjs and mdh1418 via 0d3f37a July 14, 2025 21:14
@noahfalk
noahfalk enabled auto-merge (squash) July 14, 2025 21:15
@noahfalk

noahfalk commented Jul 14, 2025 •

Copy link
Copy Markdown
Member Author

I just accepted Mitchell's suggestion but it reset the review gate. But if someone can accept again - yep ready to merge!

@noahfalk
noahfalk merged commit 220408e into dotnet:main Jul 14, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants