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

System.Net.Http.Functional.Tests.HttpMetricsTest_Http20.AllSocketsHttpHandlerCounters_Success_Recorded item comparison failure #101285

Closed
MichalStrehovsky opened this issue Apr 19, 2024 · 3 comments · Fixed by #105876
Assignees
Labels
area-System.Net.Http blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' bug in-pr There is an active PR which will close this issue when it is merged Known Build Error Use this to report build issues in the .NET Helix tab test-run-core Test failures in .NET Core test runs
Milestone

Comments

@MichalStrehovsky
Copy link
Member

MichalStrehovsky commented Apr 19, 2024

    System.Net.Http.Functional.Tests.HttpMetricsTest_Http20.AllSocketsHttpHandlerCounters_Success_Recorded [FAIL]
      Assert.Collection() Failure: Item comparison failure
                                                                                                                                                                                                                                                                                                                                             ↓ (pos 9)
      Collection: [···, http.client.active_requests=-1 [url.scheme=https, server.address=127.0.0.1, server.port=39899, http.request.method=GET], http.client.request.duration=0.0346855 [url.scheme=https, server.address=127.0.0.1, server.port=39899, http.request.method=GET, http.response.status_code=200, network.protocol.version=2], http.client.open_connections=-1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=idle], http.client.open_connections=1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=active], http.client.open_connections=-1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=active], ···]
      Error:      Assert.Equal() Failure: Strings differ
                                         ↓ (pos 12)
                  Expected: "http.client.connection.duration"
                  Actual:   "http.client.open_connections"
                                         ↑ (pos 12)
      Stack Trace:
        /_/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs(624,0): at System.Net.Http.Functional.Tests.HttpMetricsTest.<>c__DisplayClass19_0.<<AllSocketsHttpHandlerCounters_Success_Recorded>b__0>d.MoveNext()
        --- End of stack trace from previous location ---
        /_/src/libraries/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs(120,0): at System.Threading.Tasks.TaskTimeoutExtensions.GetRealException(Task task)
        --- End of stack trace from previous location ---
        /_/src/libraries/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs(90,0): at System.Threading.Tasks.TaskTimeoutExtensions.WhenAllOrAnyFailed(Task[] tasks)
        /_/src/libraries/Common/tests/System/Net/Http/GenericLoopbackServer.cs(44,0): at System.Net.Test.Common.LoopbackServerFactory.<>c__DisplayClass6_0.<<CreateClientAndServerAsync>b__0>d.MoveNext()
        --- End of stack trace from previous location ---
        /_/src/libraries/Common/tests/System/Net/Http/Http2LoopbackServer.cs(235,0): at System.Net.Test.Common.Http2LoopbackServerFactory.CreateServerAsync(Func`3 funcAsync, Int32 millisecondsTimeout, GenericLoopbackOptions options)
        /_/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs(581,0): at System.Net.Http.Functional.Tests.HttpMetricsTest.AllSocketsHttpHandlerCounters_Success_Recorded()
        --- End of stack trace from previous location ---
      Output:
        http.client.active_requests=1 [url.scheme=https, server.address=127.0.0.1, server.port=39899, http.request.method=GET]
        http.client.open_connections=1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=idle]
        http.client.open_connections=-1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=idle]
        http.client.open_connections=1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=active]
        http.client.request.time_in_queue=0.0337241 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, http.request.method=GET]
        http.client.open_connections=-1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=active]
        http.client.open_connections=1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=idle]
        http.client.active_requests=-1 [url.scheme=https, server.address=127.0.0.1, server.port=39899, http.request.method=GET]
        http.client.request.duration=0.0346855 [url.scheme=https, server.address=127.0.0.1, server.port=39899, http.request.method=GET, http.response.status_code=200, network.protocol.version=2]
        http.client.open_connections=-1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=idle]
        http.client.open_connections=1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=active]
        http.client.open_connections=-1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=active]
        http.client.open_connections=1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=idle]
        http.client.connection.duration=0.016 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1]
        http.client.open_connections=-1 [network.protocol.version=2, url.scheme=https, server.address=127.0.0.1, server.port=39899, network.peer.address=::ffff:127.0.0.1, http.connection.state=idle]

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=726853
Build error leg or test failing: Build / Libraries Test Run release coreclr linux x64 Debug / Send to Helix
Pull request: #101229

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorMessage": "",
  "ErrorPattern": "Expected:.*http.client.connection.duration",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=649095
Error message validated: [Expected:.*http.client.connection.duration]
Result validation: ❌ Known issue did not match with the provided build.
Validation performed at: 4/19/2024 11:22:20 AM UTC

Report

Build Definition Test Pull Request
763965 dotnet/runtime System.Net.Http.Functional.Tests.HttpMetricsTest_Http20.AllSocketsHttpHandlerCounters_Success_Recorded #105866
731726 dotnet/runtime System.Net.Http.Functional.Tests.SyncHttpHandler_DiagnosticsTest.SendAsync_Success_ConnectionActivityRecordedWithChildren #103922

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
1 1 2
@MichalStrehovsky MichalStrehovsky added area-System.Net.Http blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab labels Apr 19, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 19, 2024
Copy link
Contributor

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

@MihaZupan MihaZupan added this to the 9.0.0 milestone Apr 21, 2024
@MihaZupan MihaZupan removed the untriaged New issue has not been triaged by the area owner label Apr 21, 2024
@karelz karelz added the test-run-core Test failures in .NET Core test runs label Jun 25, 2024
@liveans
Copy link
Member

liveans commented Jul 12, 2024

My inital guess related to this is:

// Can be called by the HttpConnectionPool after TryReserveStream if the stream doesn't end up being used.
// Otherwise, will be called when the request is complete and stream is closed.
public void ReleaseStream()

First comment is happening, just before Shutdown. I'm not sure if this is expected behavior but looks like this is happening when we're trying to return Http2Connection to the pool. If this is expected in some cases, fix should be straightforward for the test.

/cc @MihaZupan

@liveans liveans self-assigned this Jul 18, 2024
@MihaZupan
Copy link
Member

You're right about the cause here being the TryReserve/Release as part of returning the connection.

But IMO this is a product issue that we're emitting not idle + idle as part of connection pooling even though there are no requests. We should likely change our logic here to behave closer to H3, where we emit non-idle only as part of SendAsync instead of TryReserveStream:

if (_activeRequests.Count == 0)
{
MarkConnectionAsNotIdle();
}

@MihaZupan MihaZupan added the bug label Aug 2, 2024
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Aug 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Net.Http blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' bug in-pr There is an active PR which will close this issue when it is merged Known Build Error Use this to report build issues in the .NET Helix tab test-run-core Test failures in .NET Core test runs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants