Skip to content
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

[HttpStress] Track unobserved exceptions #114225

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

antonfirsov
Copy link
Member

@antonfirsov antonfirsov commented Apr 3, 2025

This is a variant of #105336/#111126 I actually intend to merge, assuming it won't kill CI.

With this PR the presence of such exceptions is only informative and doesn't fail the test. If addressing #114128 (comment) would bring them to zero after multiple runs, we can revisit this decision.

@Copilot Copilot bot review requested due to automatic review settings April 3, 2025 17:15
@antonfirsov
Copy link
Member Author

/azp run runtime-libraries stress-http

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 enhances the HttpStress test harness by tracking unobserved exceptions and reporting their occurrence without causing test failures. It introduces a new command line option, a dictionary to store exception occurrences, and updates the configuration accordingly.

  • Added a static dictionary to track unobserved exceptions.
  • Registered an event handler for TaskScheduler.UnobservedTaskException.
  • Provided a new CLI option and configuration property to control this behavior.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/libraries/System.Net.Http/tests/StressTests/HttpStress/Program.cs Added tracking for unobserved exceptions and printed a summary report
src/libraries/System.Net.Http/tests/StressTests/HttpStress/Configuration.cs Added a nullable boolean property to enable or disable exception tracking

{
lock (s_unobservedExceptions)
{
string text = e.Exception.ToString();
Copy link
Preview

Copilot AI Apr 3, 2025

Choose a reason for hiding this comment

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

Consider using a more concise identifier for exceptions (e.g. exception type and message) instead of the full output of ToString(), to avoid using overly verbose keys in the dictionary and potential memory overhead.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Copy link
Member Author

@antonfirsov antonfirsov Apr 3, 2025

Choose a reason for hiding this comment

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

The CI test run will show if the overhead is high. Even if that's the case, fixing #114128 should significantly reduce it.

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@ManickaP ManickaP left a comment

Choose a reason for hiding this comment

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

:shipit:
Great!!! Hopefully, after #114226 this will be clean!!! Yay 🥳

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

great!

@@ -210,10 +230,28 @@ private static async Task<ExitCode> Run(Configuration config)
client?.Stop();
client?.PrintFinalReport();

if (trackUnobservedExceptions)
{
PrintUnobservedExceptions();
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider stress as failed if we see any? Just so we don't ignore them by accident.

Copy link
Member Author

@antonfirsov antonfirsov Apr 4, 2025

Choose a reason for hiding this comment

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

My plan is to monitor the results after #114226 first to make sure we don't add too much noise here.

@antonfirsov
Copy link
Member Author

/ba-g CI failures are unrelated

@antonfirsov antonfirsov merged commit ff18c30 into dotnet:main Apr 4, 2025
85 of 94 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.

4 participants