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

Fix SocketsHttpHandler metrics test on Android #90225

Closed

Conversation

MihaZupan
Copy link
Member

Saw failures like these in a few runtime-extra-platforms runs.
My guess is the test ended up using the mobile platform handler instead of SocketsHttpHandler.

Assert.Collection() Failure
Collection: [http.client.active_requests=1 [url.scheme=http, server.address=127.0.0.1, server.port=42873, http.request.method=GET], http.client.active_requests=-1 [url.scheme=http, server.address=127.0.0.1, server.port=42873, http.request.method=GET], http.client.request.duration=0.0143246 [url.scheme=http, server.address=127.0.0.1, server.port=42873, http.request.method=GET, http.response.status_code=200, network.protocol.version=1.1]]
Expected item count: 11
Actual item count:   3
   at System.Net.Http.Functional.Tests.HttpMetricsTest.<>c__DisplayClass19_0.<<AllSocketsHttpHandlerCounters_Success_Recorded>b__0>d.MoveNext() in /_/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs:line 618
--- End of stack trace from previous location ---
   at System.Threading.Tasks.TaskTimeoutExtensions.GetRealException(Task task) in /_/src/libraries/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs:line 120
--- End of stack trace from previous location ---
   at System.Threading.Tasks.TaskTimeoutExtensions.WhenAllOrAnyFailed(Task[] tasks) in /_/src/libraries/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs:line 90
   at System.Net.Test.Common.LoopbackServerFactory.<>c__DisplayClass6_0.<<CreateClientAndServerAsync>b__0>d.MoveNext() in /_/src/libraries/Common/tests/System/Net/Http/GenericLoopbackServer.cs:line 44
--- End of stack trace from previous location ---
   at System.Net.Test.Common.LoopbackServer.CreateServerAsync(Func`2 funcAsync, Options options) in /_/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs:line 107
   at System.Net.Http.Functional.Tests.HttpMetricsTest.AllSocketsHttpHandlerCounters_Success_Recorded() in /_/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs:line 575

@ghost
Copy link

ghost commented Aug 9, 2023

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

Issue Details

Saw failures like these in a few runtime-extra-platforms runs.
My guess is the test ended up using the mobile platform handler instead of SocketsHttpHandler.

Assert.Collection() Failure
Collection: [http.client.active_requests=1 [url.scheme=http, server.address=127.0.0.1, server.port=42873, http.request.method=GET], http.client.active_requests=-1 [url.scheme=http, server.address=127.0.0.1, server.port=42873, http.request.method=GET], http.client.request.duration=0.0143246 [url.scheme=http, server.address=127.0.0.1, server.port=42873, http.request.method=GET, http.response.status_code=200, network.protocol.version=1.1]]
Expected item count: 11
Actual item count:   3
   at System.Net.Http.Functional.Tests.HttpMetricsTest.<>c__DisplayClass19_0.<<AllSocketsHttpHandlerCounters_Success_Recorded>b__0>d.MoveNext() in /_/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs:line 618
--- End of stack trace from previous location ---
   at System.Threading.Tasks.TaskTimeoutExtensions.GetRealException(Task task) in /_/src/libraries/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs:line 120
--- End of stack trace from previous location ---
   at System.Threading.Tasks.TaskTimeoutExtensions.WhenAllOrAnyFailed(Task[] tasks) in /_/src/libraries/Common/tests/System/Threading/Tasks/TaskTimeoutExtensions.cs:line 90
   at System.Net.Test.Common.LoopbackServerFactory.<>c__DisplayClass6_0.<<CreateClientAndServerAsync>b__0>d.MoveNext() in /_/src/libraries/Common/tests/System/Net/Http/GenericLoopbackServer.cs:line 44
--- End of stack trace from previous location ---
   at System.Net.Test.Common.LoopbackServer.CreateServerAsync(Func`2 funcAsync, Options options) in /_/src/libraries/Common/tests/System/Net/Http/LoopbackServer.cs:line 107
   at System.Net.Http.Functional.Tests.HttpMetricsTest.AllSocketsHttpHandlerCounters_Success_Recorded() in /_/src/libraries/System.Net.Http/tests/FunctionalTests/MetricsTest.cs:line 575
Author: MihaZupan
Assignees: MihaZupan
Labels:

area-System.Net.Http

Milestone: -

@MihaZupan
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@MihaZupan MihaZupan added this to the 8.0.0 milestone Aug 9, 2023
@MihaZupan
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@simonrozsival
Copy link
Member

@MihaZupan I think the problem must be somewhere else. The native mobile handler is located in the xamarin-android repo and AFAIK we can only use the HttpClientHandler on top of SocketsHttpHandler in runtime tests.

@MihaZupan
Copy link
Member Author

Thanks @simonrozsival, you're right, it was using the correct handler.
The actual issue was that we weren't flowing down the meter factory correctly - I opened #90298.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants