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

SendAsync_RequestVersion20_ResponseVersion20 consistently fails #72959

Open
danmoseley opened this issue Jul 27, 2022 · 13 comments
Open

SendAsync_RequestVersion20_ResponseVersion20 consistently fails #72959

danmoseley opened this issue Jul 27, 2022 · 13 comments

Comments

@danmoseley
Copy link
Member

This on my Windows 10 21H2 machine. I'm guessing I have some particular setting in my registry or something - let me know if I can check for something.

All other tests pass.

C:\git\runtime>dotnet build /t:test src\libraries\System.Net.Http.WinHttpHandler\tests\FunctionalTests /p:xunitoptions="-method System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20"
....
  ----- start Wed 07/27/2022 13:39:37.32 ===============  To repro directly: ==========================================
  ===========
  pushd C:\git\runtime\artifacts\bin\System.Net.Http.WinHttpHandler.Functional.Tests\Debug\net7.0-windows\
 "C:\git\runtime\artifacts\bin\testhost\net7.0-windows-Debug-x64\dotnet.exe" exec --runtimeconfig System.Net.Http.WinHttpHandler.Functional.Tests.runtimeconfig.json --depsfile System.Net.Http.WinHttpHandler.Functional.Tests.deps.json xunit.console.dll System.Net.Http.WinHttpHandler.Functional.Tests.dll -xml testResults.xml -nologo -notrait category=failing -method System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20
  popd
  ===========================================================================================================
    Discovering: System.Net.Http.WinHttpHandler.Functional.Tests (method display = ClassAndMethod, method display optio
  ns = None)
    Discovered:  System.Net.Http.WinHttpHandler.Functional.Tests (found 1 of 525 test case)
    Starting:    System.Net.Http.WinHttpHandler.Functional.Tests (parallel test collections = on, max threads = 8)
      System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20(
  server: https://www.microsoft.com/) [FAIL]
        Assert.Equal() Failure
        Expected: OK
        Actual:   Forbidden
        Stack Trace:
          C:\git\runtime\src\libraries\Common\tests\System\Net\Http\HttpClientHandlerTest.RemoteServer.cs(1369,0): at S
  ystem.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20(Uri s
  erver)
          --- End of stack trace from previous location ---
        Output:
          https://www.microsoft.com/
    Finished:    System.Net.Http.WinHttpHandler.Functional.Tests
  === TEST EXECUTION SUMMARY ===
     System.Net.Http.WinHttpHandler.Functional.Tests  Total: 1, Errors: 0, Failed: 1, Skipped: 0, Time: 0.810s
@ghost
Copy link

ghost commented Jul 27, 2022

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

Issue Details

This on my Windows 10 21H2 machine. I'm guessing I have some particular setting in my registry or something - let me know if I can check for something.

All other tests pass.

C:\git\runtime>dotnet build /t:test src\libraries\System.Net.Http.WinHttpHandler\tests\FunctionalTests /p:xunitoptions="-method System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20"
....
  ----- start Wed 07/27/2022 13:39:37.32 ===============  To repro directly: ==========================================
  ===========
  pushd C:\git\runtime\artifacts\bin\System.Net.Http.WinHttpHandler.Functional.Tests\Debug\net7.0-windows\
 "C:\git\runtime\artifacts\bin\testhost\net7.0-windows-Debug-x64\dotnet.exe" exec --runtimeconfig System.Net.Http.WinHttpHandler.Functional.Tests.runtimeconfig.json --depsfile System.Net.Http.WinHttpHandler.Functional.Tests.deps.json xunit.console.dll System.Net.Http.WinHttpHandler.Functional.Tests.dll -xml testResults.xml -nologo -notrait category=failing -method System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20
  popd
  ===========================================================================================================
    Discovering: System.Net.Http.WinHttpHandler.Functional.Tests (method display = ClassAndMethod, method display optio
  ns = None)
    Discovered:  System.Net.Http.WinHttpHandler.Functional.Tests (found 1 of 525 test case)
    Starting:    System.Net.Http.WinHttpHandler.Functional.Tests (parallel test collections = on, max threads = 8)
      System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20(
  server: https://www.microsoft.com/) [FAIL]
        Assert.Equal() Failure
        Expected: OK
        Actual:   Forbidden
        Stack Trace:
          C:\git\runtime\src\libraries\Common\tests\System\Net\Http\HttpClientHandlerTest.RemoteServer.cs(1369,0): at S
  ystem.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20(Uri s
  erver)
          --- End of stack trace from previous location ---
        Output:
          https://www.microsoft.com/
    Finished:    System.Net.Http.WinHttpHandler.Functional.Tests
  === TEST EXECUTION SUMMARY ===
     System.Net.Http.WinHttpHandler.Functional.Tests  Total: 1, Errors: 0, Failed: 1, Skipped: 0, Time: 0.810s
Author: danmoseley
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 27, 2022
@danmoseley
Copy link
Member Author

It fails on .NET Framework 4.8 as well, so unlikely a product issue but rather a configuration issue.

@wfurt
Copy link
Member

wfurt commented Jul 27, 2022

This goes to external server. MsIT may interfere - either the VPN or security setting. I would suggest to check Defender logs. (and possibly disable online threads scanning as experiment)

@danmoseley
Copy link
Member Author

which logs to check? nothing relevant appears in these:
image

@danmoseley
Copy link
Member Author

I found how to enable firewall logging (pfirewall.log), enabled everything, and it seems that the firewall is not blocking it.

@wfurt
Copy link
Member

wfurt commented Jul 27, 2022

I'm not expert but it feels like this would be coming from some L7 inspection. e.g. likely Defender or some other thread analyses tool. It would also be curious if WinHttpHandler fails but SocketHttpHandler does not.

@karelz
Copy link
Member

karelz commented Aug 2, 2022

Triage: No hit in CI, likely environmental issue. Moving to Future.

let failedTests = (testNameSubstring : string, methodName : string, includePR : bool, messageSubstr: string, includePassedOnRerun : bool) {
cluster('engsrvprod.kusto.windows.net').database('engineeringdata').AzureDevOpsTests
    | where TestName contains testNameSubstring
    | where includePassedOnRerun or (Outcome == 'Failed')
    | extend startOfTestName = indexof_regex(TestName, @"[^.]+$")
    | extend Method = substring(TestName, startOfTestName)
    | extend Type = substring(TestName, 0, startOfTestName - 1)
    | project-away startOfTestName
    | where (methodName == '') or (Method == methodName)
    | where Message contains messageSubstr
    | distinct JobId, WorkItemId, Message, StackTrace, Method, Type, Arguments, Outcome
    | join kind=inner (cluster('engsrvprod.kusto.windows.net').database('engineeringdata').Jobs
        | where ((Branch == 'refs/heads/main') or (Branch == 'refs/heads/master') or (includePR and (Source startswith "pr/")))
        | where Type startswith "test/functional/cli/"
            and not(Properties contains "runtime-staging")
        | summarize arg_max(Finished, Properties, Type, Branch, Source, Started, QueueName) by JobId
        | project-rename JobType = Type) on JobId
    | extend PropertiesJson = parse_json(Properties)
    | extend OS = replace_regex(tostring(PropertiesJson.operatingSystem), @'\((.*)\).*|([^\(].*)', @'\1\2')
    | extend Runtime = iif(PropertiesJson.runtimeFlavor == "mono", "Mono", iif(PropertiesJson.DefinitionName contains "coreclr", "CoreCLR", ""))
    | extend TargetBranch = extractjson("$.['System.PullRequest.TargetBranch']", Properties)
    | extend Architecture = PropertiesJson.architecture
    | extend Scenario = iif(isempty(PropertiesJson.scenario), "--", PropertiesJson.scenario)
    //| extend DefinitionName = PropertiesJson.DefinitionName
    | project-away PropertiesJson
};
failedTests('', 'SendAsync_RequestVersion20_ResponseVersion20', true, 'Forbidden', true);

@karelz karelz added this to the Future milestone Aug 2, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Aug 2, 2022
@danmoseley
Copy link
Member Author

danmoseley commented Sep 9, 2022

Still failing for me (not blocking, zero urgency) -- if anyone has steps I can use to investigate more (than I did above) -- LMK..

@rzikm
Copy link
Member

rzikm commented Nov 26, 2024

This started happening again recently, but I can't reproduce this failure locally.

let _Branch = 'main';
let _IncludePRs = true;
let _endTime = datetime(2024-11-26T09:30:00Z);
let _startTime = datetime(2024-11-19T09:30:00Z);
let _TestName = 'System.Net.Http.Functional.Tests.HttpClientHandler_RemoteServerTest.SendAsync_RequestVersion20_ResponseVersion20';
let _OS = dynamic(null);
// baseQuery RelevantJobs
let RelevantJobs = () {
    // Please enter your KQL query (Example):
    // <table name>
    // | where <datetime column> between (['_startTime'] .. ['_endTime']) // Time range filtering
    // | where isempty(['_IncludePRs']) or <column name> == ['_IncludePRs'] // Single selection filtering
    // | where isempty(['_SkipPassingOnMain']) or <column name> == ['_SkipPassingOnMain'] // Single selection filtering
    // | where isempty(['OSes']) or <column name> in (['OSes']) // Multiple selection filtering
    // | where isempty(['FriendlyNames']) or <column name> in (['FriendlyNames']) // Multiple selection filtering
    // | where isempty(['_Branch']) or <column name> in (['_Branch']) // Multiple selection filtering
    // | where isempty(['_ExcludeOS']) or <column name> in (['_ExcludeOS']) // Multiple selection filtering
    // | where isempty(['_TestName']) or <column name> == ['_TestName'] // Freetext filtering
    // | take 100
    Jobs
    | extend TargetBranch = extractjson("$.['System.PullRequest.TargetBranch']", Properties)
    | extend BuildId = extractjson("$.['BuildId']", Properties)
    | extend DefinitionName = extractjson("$.['DefinitionName']", Properties)
    | where Type startswith "test/functional/cli/"
        and Finished >= _startTime and Finished < _endTime
        and not(Properties contains "runtime-staging")
        and not(QueueName contains "appletv")
        and (Branch has_cs _Branch or (_IncludePRs and TargetBranch has_cs _Branch))
    | extend OS = replace_regex(extractjson("$.operatingSystem", Properties), @'\((.*)\).*|([^\(].*)', @'\1\2')
    | project-keep JobId, Started, Finished, Properties, Branch, BuildId, Source, OS, Attempt, Type, DefinitionName
};
// baseQuery FilteredTestFailures
let FilteredTestFailures = () {
    let results = view() {AzureDevOpsTests
        | where TestName has ['_TestName']
            and Outcome == 'Failed'// or Outcome == 'PassedOnRerun'
        | distinct JobId, WorkItemId, Message, StackTrace, TestName, Arguments, Outcome
        | join kind=inner (RelevantJobs
            | summarize arg_max(Finished, Properties, Branch, Source, Started, OS, Attempt, BuildId) by JobId) on JobId
        | extend PropertiesJson = parse_json(Properties)
        | extend OS = replace_regex(tostring(PropertiesJson.operatingSystem), @'\((.*)\).*|([^\(].*)', @'\1\2')
        | extend Runtime = iif(PropertiesJson.runtimeFlavor == "mono", "Mono", iif(PropertiesJson.DefinitionName contains "coreclr", "CoreCLR", ""))
        | extend TargetBranch = extractjson("$.['System.PullRequest.TargetBranch']", Properties)
        | extend Architecture = PropertiesJson.architecture
        | extend DefinitionName = PropertiesJson.DefinitionName
        | project-away JobId
        | extend JobId = extractjson("$.['System.JobId']", Properties)
        | extend JobUrl = strcat("https://dev.azure.com/dnceng-public/public/_build/results?buildId=", BuildId, "&view=logs&j=", JobId)
        | join kind=inner (cluster('engsrvprod.kusto.windows.net').database('engineeringdata').WorkItems
            | project-keep ConsoleUri, WorkItemId) on WorkItemId
        | project-away PropertiesJson
        | project-reorder Started, Arguments, StackTrace, ConsoleUri, OS, Architecture, DefinitionName, Branch, Attempt, BuildId, *
    };
    let flag = isnotempty(_TestName);
    union (results() | where flag)
};
FilteredTestFailures
| where isempty(_OS) or _OS contains OS

@wfurt
Copy link
Member

wfurt commented Nov 26, 2024

Is it somewhat consistent? If the is infrastructure issue we may try Helix repro machines or we may need to inject instrumented code via PR.

@rzikm
Copy link
Member

rzikm commented Jan 21, 2025

The issue seems to be consistently happening on CI machines

@wfurt
Copy link
Member

wfurt commented Jan 21, 2025

I'm wondering if the "forbidden" comes from some rate limiting device. I see no reason why https://www.microsoft.com/ should fail like this. I would suggest to perhaps use different site or accept the forbidden as well as long as the request/response versions are what we expecting.

@ManickaP
Copy link
Member

Has it ever failed on anything else than Windows? When I saw it in my PR it looked like it was passing on Linux.

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

No branches or pull requests

5 participants