Skip to content

Fix hang in InvalidClientRequestTests by guarding oversized Content-Length cases to managed implementation - #132321

Draft
alinpahontu2912 wants to merge 1 commit into
dotnet:mainfrom
alinpahontu2912:fix/httplistener-invalidrequest-guard
Draft

Fix hang in InvalidClientRequestTests by guarding oversized Content-Length cases to managed implementation#132321
alinpahontu2912 wants to merge 1 commit into
dotnet:mainfrom
alinpahontu2912:fix/httplistener-invalidrequest-guard

Conversation

@alinpahontu2912

Copy link
Copy Markdown
Member

Two new  InvalidClientRequestTests  cases test oversized  Content-Length  rejection, but run against Windows' native http.sys path too, which doesn't reject them the same way — causing a hang until Helix's timeout. Guards them with  Helpers.IsManagedImplementation  so they only run against the managed parser they're meant to test.

InvalidRequest_TestData fed two new POST cases with Content-Length
values above long.MaxValue directly into GetContext_InvalidRequest_DoesNotGetContext,
which also runs against the native http.sys-backed HttpListenerRequest.Windows.cs
on Windows. http.sys does not reject these oversized values the same way the
managed parser (HttpListenerRequest.Managed.cs) now does, so the server never
completes the request and the test hangs until the Helix executor timeout kills
the work item.

Wrap the two new test cases in an 'if (Helpers.IsManagedImplementation)' guard,
matching the existing pattern used elsewhere in this file, so they only run
against the managed implementation whose behavior they were written to verify.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: bcc5e304-cc27-44b0-aac3-b9eada42d13f
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates InvalidClientRequestTests to avoid Helix timeouts/hangs on Windows by ensuring the oversized Content-Length rejection cases only run against the managed HttpListener implementation (where that behavior is expected and validated).

Changes:

  • Guard the two oversized Content-Length test vectors (e.g., long.MaxValue + 1, ulong.MaxValue) behind Helpers.IsManagedImplementation.
  • Prevent these cases from running on the Windows http.sys-backed implementation, which can otherwise wait for an (effectively) unbounded request body and hang the test.

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.

2 participants