Repository navigation
Add opt-in HTTP client recovery for transient network errors - #16662
Draft
Julio César Rocha (JunielKatarn) wants to merge 5 commits into
Draft
Julio César Rocha (JunielKatarn) wants to merge 5 commits into
Julio César Rocha (JunielKatarn) wants to merge 5 commits into
Conversation
Add fail-once integration coverage for OfficeDev/office-js#4972 and unit specifications for fresh-client retry policy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 49ef9095-9eea-4a32-a660-c04ea1965495
Gate fresh-client retries for transient GET and HEAD failures behind Http.RetryOnTransientNetworkError while preserving cancellation, timeout, and concurrency behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 49ef9095-9eea-4a32-a660-c04ea1965495
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 88a87e75-1858-477f-be48-24484ba8eb86
| </PreprocessorDefinitions> | ||
| <AdditionalIncludeDirectories> | ||
| $(VCInstallDir)UnitTest\include; | ||
| "$(IntDir)\..\React.Windows.Desktop\Generated Files"; |
Contributor
Author
There was a problem hiding this comment.
(nit) Is there a better macro to resolve this path?
| #include <CppUnitTest.h> | ||
|
|
||
| #include <CppRuntimeOptions.h> | ||
| #include <Networking\WinRTHttpResource.h> |
Contributor
Author
There was a problem hiding this comment.
TODO: Forward-slash
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 88a87e75-1858-477f-be48-24484ba8eb86
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Type of Change
Why
Classic Outlook launch-event add-ins (OfficeDev/office-js#4972) report
fetch()calls that stall or fail with WinINet transport errors (e.g.0x80072efd,0x80072ee7,0x80072ee2) after sleep/resume on machines using a loopback HTTP proxy with PAC rules. Requests only recover minutes later or after restarting Outlook.WinRTHttpResourcekeeps a singleHttpClient/filter chain for the lifetime of the React instance, so it can keep reusing stale connection/proxy state after a network transition. This change adds an opt-in, bounded recovery path that retries once through a freshly constructed client.Resolves OfficeDev/office-js#4972
What
Adds the boolean RuntimeOption
Http.RetryOnTransientNetworkError(defaultfalse; existing behavior is unchanged unless enabled).When enabled,
WinRTHttpResourceretries at most once, using a newly constructed filter andHttpClientchain, when:GETorHEAD(case-insensitive; the transmitted method spelling is preserved), andIt does not retry:
POSTor other potentially non-idempotent methods.ERROR_INTERNET_FORCE_RETRY.Other details:
GET /officedev/office-js/issues/4972/{id}) that aborts the first connection before response headers and returns 200 on the second request.Reviewers: please pay particular attention to the selected retryable HRESULT set, and whether the RuntimeOption name/activation mechanism is appropriate for the intended host rollout.
Screenshots
N/A
Testing
Added deterministic unit tests (
vnext/Desktop.UnitTests/WinRTHttpResourceUnitTest.cpp) using an injected client factory to count client generations. They cover:Added integration test
OfficeDev_OfficeJS_4972_RetriesGetWithFreshClientAfterConnectionFailure(vnext/Desktop.IntegrationTests/HttpResourceIntegrationTests.cpp), which drives a real Kestrel connection reset through the full WinRT transport and verifies recovery.Ran locally (x64 Debug, after rebasing on
main):msbuild vnext\ReactWindows-Desktop.sln /m /r: succeeded.vstest.console.exe vnext\target\x64\Debug\React.Windows.Desktop.UnitTests\React.Windows.Desktop.UnitTests.dll --InIsolation --Platform:x64: 123 total, 120 passed, 3 skipped (pre-existing CORS skips), 0 failed..\vnext\Scripts\IntegrationTests.ps1 -NoServers -Include HttpResourceIntegrationTest(with TestWebSite running): 13 passed, 0 failed.Known gaps: the tests do not reproduce enterprise PAC/loopback proxy software or real sleep/resume transitions; these are better suited to manual/lab validation.
Changelog
Should this change be included in the release notes: yes
Add opt-in
Http.RetryOnTransientNetworkErrorRuntimeOption that retries idempotent (GET/HEAD) requests once through a fresh HTTP client after transient network transport failures.Microsoft Reviewers: Open in CodeFlow