Repository navigation
Add memory leak tests for request handling and hot reload - #2170
Conversation
Adds MemoryRetentionTests to DevProxy.Integration.Tests: - Hot reload: runs 20 generations through the real host-building code and config file watcher and checks that previous generations' WebApplication, service provider, command and plugins are collected. - Requests: proxies successful (mocked, passed-through, large bodies) and failed/cancelled requests through the Kestrel engine with the real console formatter, and checks proxy sessions are collected and the managed heap stays within a bound. - Canary tests add a deliberate leak and assert both checks catch it. The hot reload and failed/cancelled request checks are skipped until dotnet#2153 and dotnet#2151 fix the leaks they detect on main. To build hosts like Program.cs does, the host-building functions move from Program.cs into ProxyHost, unchanged. Closes dotnet#2160 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
The memory-retention tests accept empty tracking samples, allowing collection checks and the canary to pass without validating session retention.
1 open issue
What changed in this PR
Adds memory-retention regression tests for Dev Proxy’s request handling and hot reload, addressing #2160 using the existing integration harness and shared production host setup.
Changes:
- Adds heap-growth and weak-reference checks, plus deliberate-leak canaries. Known-leak tests remain skipped pending #2151 and #2153.
- Extracts host-building helpers into
ProxyHostfor reuse by integration tests. - Extends the fake origin and aligns test dependencies with the application.
| File | Description |
|---|---|
DevProxy/ProxyHost.cs |
Houses the extracted host-building and logging helpers. |
DevProxy/Program.cs |
Uses the shared helpers through a static import. |
DevProxy/DevProxy.csproj |
Grants integration tests access to internal APIs. |
DevProxy.Integration.Tests/MemoryRetentionTests.cs |
Adds request and hot-reload retention checks and canaries. |
DevProxy.Integration.Tests/FakeOrigin.cs |
Adds optional recording and abort/delay endpoints. |
DevProxy.Integration.Tests/DevProxy.Integration.Tests.csproj |
References the application, aligns OpenTelemetry versions, and suppresses threading warnings. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The GC-sensitive memory-retention assertions and file-watcher retry behavior were validated only on macOS, leaving the required repeated Linux and Windows stability checks outstanding.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Repeated Linux and Windows validation is still needed to establish cross-platform stability of the forced-GC, heap-growth, and hot-reload watcher checks, since supplied validation covers macOS only.
No open issues 🎉
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
The GC/heap-growth and file-watcher tests were validated only on macOS and do not run in CI, leaving the Linux and Windows stability and heap bounds required by #2160 unverified.
No open issues 🎉
Review effort: Balanced
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: #2170
- Tested commit:
3ad8d6c1733c6ac9ab1eb275ca723c939ea7da1f - Environment: macOS, .NET SDK
10.0.103, source Debug build, isolated local HTTP/1.1 upstream and configuration fixtures. Detached mode, system proxy disabled, OS-assigned proxy/API ports; no external API or credentials required.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
dotnet restore DevProxy.sln --locked-mode then dotnet build DevProxy.Integration.Tests/DevProxy.Integration.Tests.csproj --no-restore |
Restore/build succeeds | Passed, zero build warnings/errors. Initial no-restore attempt needed the missing assets restored. | PASS |
dotnet run --no-build --project DevProxy -- --detach --as-system-proxy false --port 0 --api-port 0 --config-file <fixture> --output json; PID-scoped status, authenticated GET /proxy, routed smoke requests |
Owned instance alive; API 200; mock 201; passthrough 200 | PID 38179, initial proxy port 50357 and API port 50358; all assertions passed. | PASS |
| 1,000 warm-up + 10,000 mixed requests, concurrency 8, routed explicitly through the assigned proxy | Mock GET 201 with exact generation JSON; passthrough GET 200 with exact body; POST echoes all 65,536 bytes; large GET returns all 262,144 bytes | Every response matched. Warm-up 0.4 s; following 10,000 requests 6.2 s. This checks traffic correctness, not retained managed heap. | PASS |
| 8 upstream connection aborts + 8 client-cancelled delayed requests, followed by healthy traffic/API calls | Abort returns 502; delayed client times out; proxy remains usable | All eight 502s and eight client timeouts observed; subsequent passthrough and authenticated API returned 200. No claim that these sessions are collected. | PASS |
| Rewrite config 20 times, selecting a new mock file for each generation; rediscover ports using the owned PID | Same daemon PID applies each new configuration; mock returns corresponding generation; passthrough/API remain healthy | Generations 1-20 each returned 201 with matching JSON, passthrough 200, and authenticated API 200. Same PID throughout. | PASS |
| Inspect existing CI run 45826314287, associated with the tested head, rather than rerunning automated tests locally | Active retention checks and intentional-leak canaries execute successfully on all three OSes | Integration jobs passed: macOS 199 passed/2 skipped; Ubuntu 199 passed/2 skipped; Windows 191 passed/4 skipped. Logs explicitly show the two known-leak memory checks skipped. CI tested merge commit 4203acb containing this head and captured base. |
PASS |
| Prove collection across hot reloads and failed/cancelled requests | Zero retained generation/session objects after forced GC | HotReload_ReleasesPreviousGenerations and FailedAndCancelledRequests_DoNotRetainMemory remain intentionally skipped pending #2153 and #2151. Runtime recovery above does not establish collection. |
BLOCKED |
| #2160 repeated-run stability criterion: approximately 10 runs on Linux, macOS, Windows | Repeated GC/heap/file-watcher checks pass without flakes | Inspected current-head CI provides one successful integration run per OS, not repeated-run stability evidence. Automated tests were not rerun locally, per this testing workflow. | BLOCKED |
Requested changes
None. No reproducible functional defect attributable to this PR was established.
Outcome
Comment only, not approval or a change request. Source-build traffic and hot-reload scenarios passed, and current-head CI now does run the integration suite successfully on all three OSes (the PR description's CI statement is outdated). Full retention coverage and repeated cross-platform stability are not established by this run; the blocked rows are not passes. This report is functional testing, not code review.
All four proxy PIDs started during fixture development/testing were stopped with the matching source build and PID-specific stop, and verified absent; the owned upstream was stopped, fixtures removed, and the checkout left clean. Preliminary Python HTTP/1.0 fixture traffic hit an upstream reset/502; switching the fixture to HTTP/1.1 yielded the passing results above, so that preliminary result is inconclusive rather than a PR defect. The final run's log pathname disappeared during concurrent testing; structured assertion results were retained separately. Cleanup removed only exact owned log paths, never shared caches or other instances.
There was a problem hiding this comment.
🔵 Needs a closer look
Memory thresholds, forced-GC assertions, and file-watcher synchronization have only been validated on macOS, leaving cross-platform stability unverified pending repeated Linux and Windows runs.
No open issues 🎉
Review effort: Balanced
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: #2170
- Tested commit:
d37eb0668ab4016630f0bfdc0387cbcd7b82b05f - Captured base:
b2a9cbfef9bd434ee3b10d761814aa25d83aba20 - Environment: macOS, .NET SDK 10.0.103, source Debug build, local HTTP/1.1 upstream. Owned
HOME/CFFIXED_USER_HOMEwith pre-created Application Support directory, unique certificate path, system proxy disabled, OS-assigned ports. Other testers share this Mac; timings are descriptive, not performance gates.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
dotnet build DevProxy.Integration.Tests/DevProxy.Integration.Tests.csproj --no-restore |
Affected source projects compile | Passed, zero warnings/errors. | PASS |
dotnet run --no-build --project DevProxy -- --detach --as-system-proxy false --port 0 --api-port 0 --config-file <owned-config> --output json; PID-scoped status, authenticated API and explicitly proxied smoke requests |
Owned instance alive; API 200, mock 201, passthrough/echo/large-body 200 | PID 41571; initial proxy port 57894, API port 57895. Exact responses verified; daemon log path verified inside owned fixture home. | PASS |
| 1,000 warm-up + 10,000 mixed requests, concurrency 8 | Mock 201 with matching JSON; passthrough 200 with exact body; 65,536-byte POST echo and 262,144-byte response preserved | Every assertion passed. Warm-up 0.54 s; subsequent 10,000 requests 4.16 s. No managed-heap or speedup claim. | PASS |
| Eight upstream aborts and eight client timeouts on delayed requests, then healthy traffic/API | Abort 502, delayed client timeout, subsequent request/API 200 | All expected errors and recovery responses observed. | PASS |
| Twenty config rewrites selecting generation-specific mock files; rediscover assigned ports by owned PID | Same daemon applies generations 1-20; matching mock JSON 201; passthrough/API 200 | All twenty generations passed every assertion; same PID throughout, owned log still present after reloads. | PASS |
| Inspect current-head CI run 45968694661, not rerun automated suites locally | Active retention checks/canaries and integration suite pass on three platforms | Linux/macOS: 456 passed, 2 skipped each. Windows: 448 passed, 4 skipped. CI logs identify merge commit dcdc568, combining tested head and captured base. |
PASS |
| Establish hot-reload and failed/cancelled-request collection | Forced-GC/weak-reference release checks execute and demonstrate collection | Both release facts remain skipped in current source and all three CI logs. Successful traffic/reload recovery is not collection evidence. | BLOCKED |
| #2160 repeated cross-platform stability criterion | Approximately ten successful GC/heap/watcher runs on Linux, macOS and Windows | Current-head evidence inspected is one successful suite run per OS, not repeated-run stability. Previous-head runs do not prove this revision. | BLOCKED |
Requested changes
None based on reproduced functional defects. No PR-attributable runtime regression was established. The failed/cancelled-request retention skip still references the already-merged #2151 and needs revisiting; this workflow did not change or unskip tests.
Outcome
Comment only, bound to the tested commit. Runtime scenarios and inspected CI passed, but skipped retention checks and missing repeated cross-platform evidence prevent full functional approval. The blocked rows are not passes. This is functional testing, not code review.
Owned PID 41571 was stopped gracefully using the matching source build's PID-specific stop and verified absent. The upstream was stopped; exact owned config, state, certificate and log fixtures were removed, with no shared cleanup. The original clean checkout was restored. Sanitized results and harness are retained locally.
Replace Task.WhenAny with Task.Delay (CA2027, enabled by AnalysisLevel 11.0) and resolve the plugins path for the current target framework instead of hardcoding net10.0. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🔵 Needs a closer look
The memory tests lack repeated Linux and Windows validation, leaving their fixed heap bound and GC/file-watcher teardown stability unconfirmed across platforms.
No open issues 🎉
1 resolved since last review
Review effort: Balanced
Port the IsJsonOutputRequested parser change from main into ProxyHost. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Let tests configure services when building the host, and register a certificate authority with root and leaf paths under the test's temp folder so the test never touches the user's certificates. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: #2170
- Tested commit:
20def0f503431584bf284706d20774e2e97ac0b4 - Captured base:
ca74616f42cf13b0afd5be3eb9c5bffc6bcee529 - Environment: macOS, arm64, temporary .NET SDK
11.0.100, source Debug build. A local HTTP server supplied the upstream responses.
The test files use private paths below .devproxy/pr2170-dec-818f6340. Both HOME and CFFIXED_USER_HOME select its private home directory. The private home contains Library/Application Support before .NET starts. DEV_PROXY_CERT_PATH selects an absolute path for the private root certificate.
Other tests run on this Mac at the same time. Elapsed times below do not establish a performance improvement or a memory limit.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
Owned SDK: dotnet restore DevProxy.sln --locked-mode; dotnet build DevProxy.Integration.Tests/DevProxy.Integration.Tests.csproj --no-restore |
Restore and build succeed | Both passed. The build reported zero warnings and zero errors. The system SDK installation did not change. | PASS |
dotnet run --no-build --project DevProxy -- --detach --as-system-proxy false --install-cert false --port 0 --api-port 0 --config-file <private-config> --output json |
Process starts; its API and proxy accept requests | PID 88456 started. Initial proxy port: 61049. Initial API port: 61050. Authenticated GET /proxy returned 200; mock and upstream requests returned 201 and 200. The log path was inside the private home. |
PASS |
Local CONNECT and TLS handshake; TLS means Transport Layer Security |
Proxy uses private root and leaf certificate files | The handshake succeeded. The root file was <fixture>/root.pfx. The leaf file was <private-home>/Library/Application Support/dev-proxy/crts/localhost.pfx. Certificate trust installation stayed disabled. |
PASS |
| 1,000 warm-up requests, then 10,000 mixed requests, with eight concurrent clients | Correct status codes and complete response bodies | All responses matched: mock 201, upstream 200, exact 65,536-byte POST echo, and exact 262,144-byte response. Elapsed times: 0.25 s and 2.14 s. This check does not measure retained managed memory. |
PASS |
| Eight upstream connection aborts and eight client timeouts; then healthy requests | Abort returns 502; delayed request times out; proxy remains available |
All eight 502 responses and eight timeouts occurred. The next upstream request and authenticated API request returned 200. |
PASS |
| Twenty configuration changes, each with a different mock response file | Same process loads all configurations; responses remain correct | All twenty generations returned their correct JSON with 201. Upstream and API requests returned 200. A local TLS handshake succeeded after each reload. The root file hash stayed unchanged. |
PASS |
| Inspect existing CI run 46905646433. CI means continuous integration. | Active memory tests and other integration tests pass on all three platforms | Linux and macOS: 501 passed, 2 skipped each. Windows: 493 passed, 4 skipped. The run used merge commit 7a847b1, which combines the tested head and captured base. |
PASS |
| Check the updated test setup and CI result | The active hot-reload canary can find the .NET 11 plugin and use private certificate paths | The source derives the framework directory from the test assembly. It supplies private root and leaf paths through configureServices. The active canary belongs to the passing CI suite. This test-specific hook was not run locally; the local daemon used private environment paths. |
PASS |
| Establish collection of old generations and failed/cancelled request sessions | Both release tests execute and show that the objects are collected | HotReload_ReleasesPreviousGenerations and FailedAndCancelledRequests_DoNotRetainMemory remain skipped in source and all three CI logs. Request recovery does not prove collection. |
BLOCKED |
| Establish repeated stability on Linux, macOS and Windows, as required by #2160 | Approximately ten successful runs on each platform | The inspected current-head CI evidence contains one suite run per platform. This does not establish repeated stability. No automated test suite was rerun locally. | BLOCKED |
Startup exceptions and cleanup
None. All startup safety defaults stayed in effect. The launch also used --install-cert false.
| Scenario | Changed default | Why the default prevents reproduction | Execution environment | Safety controls | Cleanup verification |
|---|---|---|---|---|---|
| All local scenarios | None | Not applicable | Private home, state, logs, certificate files, and local upstream server | Detached process; random ports; disabled system proxy and certificate trust installation; bounded commands; recorded PID and start time | PID and start time matched before stop. The matching build stopped PID 88456. The process was absent afterward. All 43 observed proxy, API, and upstream ports were closed. |
The upstream server stopped. The exact private test directory and temporary SDK directory were removed. The original clean checkout was restored. No shared certificate cache, state directory, or log directory was deleted. Sanitized results and the test script remain outside the checkout.
Requested changes
None based on a reproduced functional defect.
The failed/cancelled-request test still has a skip reason that references merged PR #2151. This run did not remove the skip or prove collection.
Outcome
Comment only. Local runtime checks and inspected CI passed. The skipped release tests and missing repeated platform runs prevent full functional approval. No reproduced defect justifies a change request.
This report covers functional testing, not code review. No PR code was changed, pushed, or merged.
The STE language check is incomplete. STE means Simplified Technical English. The official site requires a request for the standard and dictionary. Verified ASD-STE100 conformance is not claimed.
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: #2170
- Tested commit:
20def0f503431584bf284706d20774e2e97ac0b4 - Captured PR base:
ca74616f42cf13b0afd5be3eb9c5bffc6bcee529 - Latest
mainobserved:9fd319c099fc489b0efba6427b19f55ac684f0a7 - Environment: shared macOS, arm64, temporary .NET SDK
11.0.100, source Debug build, local HTTP/1.1 server.
The tested head has not changed since the previous functional report.
PR #2153 merged on December 3, after that report.
The tested head contains #2151 but does not contain #2153.
GitHub reports merge conflicts.
This run did not change PR code or resolve conflicts.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
Owned SDK: dotnet restore <project> --locked-mode; dotnet build <project> --no-restore --disable-build-servers -v quiet, for DevProxy/DevProxy.csproj and DevProxy.Plugins/DevProxy.Plugins.csproj |
Required source projects build | Both projects built with zero warnings and zero errors after restore. The system SDK installation did not change. | PASS |
Source launch: dotnet run --no-build --project DevProxy -- --detach --as-system-proxy false --install-cert false --port 0 --api-port 0 --config-file <private-config> --output json |
Owned process starts; its API and proxy accept requests | Final run: PID 55518, proxy port 59614, API port 59615. PID-specific status succeeded. Authenticated GET /proxy returned 200. The mock returned 201; the upstream returned 200. The log path used the private home. |
PASS |
| 1,000 warm-up requests, then 10,000 mixed requests, with eight concurrent clients | Correct status codes and complete bodies | All responses matched: mock 201, upstream 200, exact 65,536-byte POST echo, and exact 262,144-byte response. This check does not measure retained memory. |
PASS |
| Eight upstream connection aborts and eight client timeouts; then healthy requests | Abort returns 502; delayed request times out; proxy remains available |
All eight 502 responses and eight timeouts occurred. The next upstream request and authenticated API request returned 200. |
PASS |
| Twenty configuration changes, each with a different mock response file | Same process loads all configurations; responses remain correct | All twenty generations returned their correct JSON with 201. Upstream and API requests returned 200. PID 55518 did not change. |
PASS |
Local CONNECT and TLS handshake before and after each reload; TLS means Transport Layer Security |
Private certificate files work across reloads | All 21 handshakes succeeded. The private root file hash did not change. The leaf file used the private home. No native trust installation occurred. | PASS |
Inspect existing CI run 46905646433, attempt 1; CI means continuous integration |
Active automated tests pass on all three platforms | Linux and macOS: 501 passed, 2 skipped each. Windows: 493 passed, 4 skipped. The logs explicitly identify both skipped collection tests. CI tested merge commit 7a847b132323e1be7774876427fae0c77eb03492, not the latest main. No automated suite ran locally. |
PASS |
| Establish collection of old generations and failed/cancelled request sessions | Both collection tests execute and show that the objects are collected | HotReload_ReleasesPreviousGenerations and FailedAndCancelledRequests_DoNotRetainMemory remain skipped in source and all three CI logs. Runtime recovery does not prove collection. The test-pr workflow requires existing CI evidence and prohibits local suite reruns. This run did not remove skips. |
BLOCKED |
| Establish repeated stability required by #2160 | Approximately ten successful runs on Linux, macOS, and Windows | The current head has one successful Build and test run, attempt 1, with one integration run per platform. This does not establish repeated stability. |
BLOCKED |
Validate integration with the latest main, including #2153 |
Combined changes build and pass the required scenarios | The head lacks #2153, and GitHub reports merge conflicts. This assignment prohibits conflict fixes and PR code changes. Exact-head results do not prove integration with the latest main. |
BLOCKED |
Startup exceptions and cleanup
None. All startup safety defaults stayed in effect. The launch also used --install-cert false.
| Scenario | Changed default | Why the default prevents reproduction | Execution environment | Safety controls | Cleanup verification |
|---|---|---|---|---|---|
| All local scenarios | None | Not applicable | Owned .devproxy/pr2170-retest-20261204 directory; private home, state, logs, root and leaf certificates; local upstream server |
Both HOME and CFFIXED_USER_HOME select the private home. DEV_PROXY_CERT_PATH selects an absolute private root path. The private home contains Library/Application Support. System proxy and trust installation stayed disabled. The script had a 240-second deadline. It recorded process IDs and start times. |
Both owned daemons stopped through the matching build with PID-specific commands. The final process check found all eight recorded processes absent. All 47 observed ports were closed. The private directory and SDK were removed. The checkout is clean. |
The first build failed because restore assets were absent.
The first launch failed because the required plugin assembly was absent.
A later TLS check failed because the test configuration did not watch its target.
I corrected the test setup and repeated all functional cases.
These setup failures do not establish PR defects.
Cleanup succeeded after each attempt.
No native proxy settings or trust stores changed.
No shared certificate cache, state directory, or log directory was deleted.
The test script and results remain outside the checkout.
Requested changes
None based on a reproduced functional defect.
Both collection tests still need execution evidence.
Repeated platform results and integration with the latest main also remain unverified.
Outcome
Comment only.
The local functional cases and existing CI checks passed.
The blocked collection, stability, and integration checks prevent functional approval.
No reproduced PR defect supports a change request.
Cleanup is complete.
This report covers functional testing, not code review.
No PR code was changed, pushed, or merged.
The STE language check is incomplete.
STE means Simplified Technical English.
The official site requires a request for the standard and dictionary.
Verified ASD-STE100 conformance is not claimed.
Preserve the ProxyHost extraction while carrying forward shared system-proxy sessions and API-port validation. Keep the memory harness aligned with the hot-reload session lifecycle and update the existing skip reason for the remaining retained generation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: #2170
- Tested commit:
ae1d3b223ae18d2312116a2fca6cfd2fb5139a42 - Captured base:
a1569b227d77c41776f00e5b4acc7348a559bdba - Environment: shared macOS, arm64, temporary .NET SDK
11.0.100, source Debug build, local HTTP/1.1 server.
This head contains merged PRs #2151 and #2153.
It also contains the latest main observed during this run.
GitHub now reports mergeable: true, with mergeable_state: blocked.
The previous merge-conflict limitation no longer applies.
Both collection tests remain skipped.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
dotnet build DevProxy/DevProxy.csproj --no-restore --disable-build-servers -v quiet; same command for DevProxy.Plugins/DevProxy.Plugins.csproj |
Required source projects build | Both builds passed with zero warnings and zero errors. Existing restore assets were sufficient. The system SDK installation did not change. | PASS |
dotnet run --no-build --project DevProxy -- --detach --as-system-proxy false --install-cert false --port 0 --api-port 0 --config-file <private-config> --output json |
Owned process starts; API and proxy accept requests | PID 88460 started. Initial proxy port: 52741. Initial API port: 52736. PID-specific status succeeded. Authenticated GET /proxy returned 200; mock and upstream requests returned 201 and 200. The log path used the private home. |
PASS |
| 1,000 warm-up requests, then 10,000 mixed requests, with eight concurrent clients | Correct status codes and complete bodies | All responses matched: mock 201, upstream 200, exact 65,536-byte POST echo, and exact 262,144-byte response. This check does not measure retained memory. |
PASS |
| Eight upstream connection aborts and eight client timeouts; then healthy requests | Abort returns 502; delayed request times out; proxy remains available |
All eight 502 responses and eight timeouts occurred. The next upstream request and authenticated API request returned 200. |
PASS |
| Twenty configuration changes, each with a different mock response file | Same process loads all configurations; responses remain correct | All twenty generations returned their correct JSON with 201. Upstream and API requests returned 200. PID 88460 did not change. |
PASS |
Local CONNECT and TLS handshake before and after each reload; TLS means Transport Layer Security |
Private certificate files work across reloads | All 21 handshakes succeeded. The root file hash did not change. The leaf file used the private home. Native trust installation stayed disabled. | PASS |
Inspect existing CI run 47324705185, attempt 1; CI means continuous integration |
Active automated tests pass on all three platforms | Linux and macOS: 506 passed, 2 skipped each. Windows: 498 passed, 4 skipped. All unit suites also passed. CI used merge commit fec45da003f0f2189b1475f7a54b7685cfd6e28a, containing this head and captured base. |
PASS |
| Verify integration with the merged #2153 fix | Combined source builds and preserves request/reload behavior | Both fixes are ancestors of this head. Current-base CI and the local functional cases above passed. GitHub reports no merge conflicts. This does not prove object collection. | PASS |
| Establish collection of old generations and failed/cancelled request sessions | Both collection tests execute and show that the objects are collected | Source and all three CI logs still skip HotReload_ReleasesPreviousGenerations and FailedAndCancelledRequests_DoNotRetainMemory. The new hot-reload skip reason states: One stopped hot-reload generation remains reachable with the process-wide SystemProxySession. This run did not independently reproduce that retention. The other skip still references merged PR #2151. |
BLOCKED |
| Establish repeated stability required by #2160 | Approximately ten successful runs on Linux, macOS, and Windows | Current-head evidence contains one Build and test run, attempt 1, with one integration run per platform. This does not establish repeated stability. |
BLOCKED |
Startup exceptions and cleanup
None. All startup safety defaults stayed in effect. The launch also used --install-cert false.
| Scenario | Changed default | Why the default prevents reproduction | Execution environment | Safety controls | Cleanup verification |
|---|---|---|---|---|---|
| All local scenarios | None | Not applicable | Owned .devproxy/pr2170-retest-1146 directory; private home, state, logs, root and leaf certificates; local upstream server |
Both HOME and CFFIXED_USER_HOME select the private home. DEV_PROXY_CERT_PATH selects an absolute private root path. The private home contains Library/Application Support. System proxy and trust installation stayed disabled. The script had a 240-second deadline. It recorded process IDs and start times. |
The PID and start time matched before stop. The matching build stopped PID 88460. All three recorded processes were absent afterward. All 43 observed ports were closed. The private directory and SDK were removed. The checkout is clean. |
The local server logged a connection reset during the run.
All response, recovery, reload, and cleanup assertions passed.
This server diagnostic alone does not establish a functional defect.
No native proxy settings or trust stores changed.
No shared certificate cache, state directory, or log directory was deleted.
The current test-pr workflow requires existing CI evidence for automated tests.
It prohibits local automated test reruns after building.
No automated suite ran locally, and this run did not remove the skips.
The test script and results remain outside the checkout.
Requested changes
None based on a reproduced functional defect.
Both collection tests still need execution evidence.
Repeated platform stability also remains unverified.
Outcome
Comment only, not approval or a change request.
The integration limitation from the previous report is resolved.
Local functional cases and existing CI checks passed.
Skipped collection tests and missing repeated platform results still prevent functional approval.
Cleanup is complete.
No PR code was changed, pushed, or merged.
This report covers functional testing, not code review.
The STE language check is incomplete.
STE means Simplified Technical English.
The official standard and dictionary are unavailable in this run.
Verified ASD-STE100 conformance is not claimed.
garrytrinder
left a comment
There was a problem hiding this comment.
Functional test results
- PR: #2170
- Tested commit:
ae1d3b223ae18d2312116a2fca6cfd2fb5139a42 - Captured base:
a1569b227d77c41776f00e5b4acc7348a559bdba - Environment: shared macOS, arm64, owned .NET SDK
11.0.100, source Debug build, local HTTP/1.1 upstream server.
The head and base have not changed since the previous report.
There are no new source changes to test.
Both merged fixes, #2151 and #2153, are ancestors of this head.
GitHub reports no merge conflicts.
This PR adds memory tests and moves host construction into ProxyHost.
It does not claim to fix the remaining memory retention.
The local checks below verify request handling and host restart behavior.
They do not measure managed memory or prove object collection.
The skipped collection tests remain relevant because #2160 explicitly requires those checks.
Native system-proxy registration and certificate trust are outside this PR's changed behavior.
Their absence is not a blocker for this test scope.
| Scenario or test command | Expected | Actual | Result |
|---|---|---|---|
Owned SDK: dotnet restore <project> --locked-mode; dotnet build <project> --no-restore --disable-build-servers -v quiet, for DevProxy/DevProxy.csproj and DevProxy.Plugins/DevProxy.Plugins.csproj |
Required source projects build | Both builds passed with zero warnings and zero errors. The first build lacked restore assets (NETSDK1004); locked restore corrected this prerequisite. |
PASS |
dotnet run --no-build --project DevProxy -- --detach --as-system-proxy false --install-cert false --port 0 --api-port 0 --config-file <private-config> --output json |
Owned process starts; its API and proxy accept requests | PID 94649 started. Initial proxy port: 49518. Initial API port: 49515. PID-specific status reported an available API. Authenticated GET /proxy returned 200; mock and upstream requests returned 201 and 200. The log used the private home. |
PASS |
| 1,000 warm-up requests, then 10,000 mixed requests, with eight concurrent clients | Correct status codes and complete bodies | All responses matched: mock 201, upstream 200, exact 65,536-byte POST echo, and exact 262,144-byte response. |
PASS |
| Eight upstream connection aborts and eight client timeouts; then healthy requests | Abort returns 502; delayed request times out; proxy remains available |
All eight 502 responses and eight timeouts occurred. The next upstream request and authenticated API request returned 200. |
PASS |
| Twenty configuration changes, each selecting a different mock response file | Same process loads all configurations; responses remain correct | All twenty generations returned their correct JSON with 201. Upstream and API requests returned 200. PID 94649 did not change. |
PASS |
Local CONNECT and TLS handshake before and after each reload; TLS means Transport Layer Security |
Private certificate files work across reloads | All 21 handshakes succeeded. The private root file hash did not change. The leaf file used the private home. The client did not require native trust installation. | PASS |
Inspect CI run 47324705185, attempt 1; CI means continuous integration |
Active automated tests pass on all three platforms | Linux and macOS: 506 passed, 2 skipped each. Windows: 498 passed, 4 skipped. Each platform also passed 185, 230, and 586 tests in the three unit suites. The unfiltered integration suite includes the three active memory tests. |
PASS |
| Establish collection of old generations and failed/cancelled request sessions | Both collection tests execute and show that the objects are collected | Source and all three CI logs skip HotReload_ReleasesPreviousGenerations and FailedAndCancelledRequests_DoNotRetainMemory. This run did not independently reproduce the retention described by either skip. Runtime recovery does not prove collection. |
BLOCKED |
| Establish repeated stability required by #2160 | Repeated successful runs on Linux, macOS, and Windows | The current head has one successful Build and test run, attempt 1, with one integration run per platform. There is no technical barrier to more CI runs. This run inspected existing CI; it did not start repeated runs. |
BLOCKED |
CI checked out merge commit fec45da003f0f2189b1475f7a54b7685cfd6e28a.
Its parents combine the tested head and captured base.
Its source tree matches the tested head exactly.
This is the same CI run cited in the previous report, not new platform evidence.
The fresh local build and runtime checks are new evidence.
The PR description's statement that CI does not run tests is outdated.
The current test-pr skill requires existing CI evidence for automated tests.
No automated suite ran locally.
This run did not remove skips or change PR code.
The hot-reload skip describes one stopped generation reachable through SystemProxySession.
The failed-request skip still references merged PR #2151.
These descriptions are not independent reproductions.
Startup exceptions and cleanup
None. All startup safety defaults stayed in effect. The launch also used --install-cert false.
| Scenario | Changed default | Why the default prevents reproduction | Execution environment | Safety controls | Cleanup verification |
|---|---|---|---|---|---|
| All local scenarios | None | Not applicable | Owned .devproxy/pr2170-retest-1155 directory; private home, state, logs, root and leaf certificates; local upstream server |
Both HOME and CFFIXED_USER_HOME select the private home. Its Library/Application Support directory existed before launch. DEV_PROXY_CERT_PATH selects an absolute private root path. System proxy and trust installation stayed disabled. The script had a 240-second deadline. It recorded process IDs and start times. |
PID and start time matched before stop. The matching build stopped PID 94649 without forced termination. All eight recorded processes were absent afterward. All 43 observed ports were closed. The private directory and SDK were removed. The checkout is clean. |
The upstream server logged one connection reset.
All response, failure-recovery, reload, and cleanup assertions passed.
This server diagnostic alone does not establish a PR defect.
No native proxy settings or trust stores changed.
No shared certificate cache, state directory, or log directory was deleted.
The sanitized results and script remain outside the checkout.
Requested changes
None based on a reproduced functional defect.
The skipped collection checks and repeated-run criterion still lack execution evidence.
Outcome
Comment only, not approval or a change request.
The local functional checks and inspected CI passed.
The missing collection and repeated-run evidence prevents full functional approval against #2160.
No reproduced PR defect supports a change request.
Cleanup is complete.
No PR code was changed, pushed, or merged.
This report covers functional testing, not code review.
The STE check is incomplete.
STE means Simplified Technical English.
The official site requires a request for the standard and dictionary.
Verified ASD-STE100 conformance is not claimed.
garrytrinder
left a comment
There was a problem hiding this comment.
Approved for the reduced scope: partial memory-test infrastructure and preserved request/reload behavior.
Tested commit: ae1d3b223ae18d2312116a2fca6cfd2fb5139a42.
Source builds, 11,000 mixed requests, failure recovery, 20 reloads, and 21 TLS handshakes passed. Existing CI passed on Linux, Windows, and macOS. Cleanup is complete.
The two collection tests remain skipped. Repeated platform stability remains unverified. I accept these limitations for this PR; neither missing check is reported as passing. Issue #2160 stays open for the remaining coverage. The description now uses a non-closing reference and states the reduced scope.
See the functional test report for evidence and limitations. This approval covers functional testing, not code review or proof that memory leaks are resolved.
The Simplified Technical English check remains incomplete because the standard and dictionary require a separate request.


Relates to #2160
Accepted scope: partial memory-test infrastructure. Collection checks for hot reload and failed/cancelled requests remain skipped. Repeated platform validation remains follow-up work. Keep #2160 open for this remaining coverage.
Adds
MemoryRetentionTeststoDevProxy.Integration.Tests, built on the existing harness (KestrelProxyHarness,FakeOrigin).What the tests check
mainHotReload_ReleasesPreviousGenerationsProgram.csuses, loadsMockResponsePluginfrom its plugin DLL via a config file, proxies a mocked and a passed-through request, then rewrites the config file and waits forConfigFileWatcherto stop the host. Repeats 20 times, then checks (withWeakReferences) that no previous generation'sWebApplication,IServiceProvider,DevProxyCommandor plugins are still reachable.Requests_DoNotRetainMemoryProxyConsoleFormatter. Checks that tracked proxy sessions are collected and the managed heap after a full GC grows by less than 8 MB.FailedAndCancelledRequests_DoNotRetainMemoryHotReload_DetectsGenerationsHeldByALeakRequests_DetectSessionsHeldByALeakThe canaries make sure the checks can't silently pass by measuring nothing.
The skipped tests reference the PR that fixes the leak in their skip reason. I verified each by applying this branch onto the PR's head, un-skipping the test and running it 5 times: all passed. The other PR doesn't fix it (on #2153 the failed-requests test still fails, on #2151 the hot-reload test still fails). Once a fix merges, remove the
Skip.Heap bound
Heap snapshots (
dotnet-gcdump, before vs after 30,000 requests) show the live growth is almost entirely 4 KB blocks in Kestrel's memory pool, which keeps growing towards its peak use long after warm-up (2k requests: 1.9 MB, 10k: ~2.8 MB, 30k: 3.8 MB). The bound is 8 MB. Leaks too small for it are covered by the per-sessionWeakReferencetracking.Other changes
BuildApplication,IsJsonOutputRequested, etc.) move fromProgram.csinto a newProxyHostclass, unchanged, so the test can build hosts the same way the app does on every hot reload.Program.csuses them throughusing static.DevProxygetsInternalsVisibleTofor the integration tests, and the integration tests referenceDevProxy. That required aligning the test project's OpenTelemetry packages withDevProxy(1.20.1 → 1.21.0, otherwise NU1605), and suppressing VSTHRD003/VSTHRD202 in the test project because the threading analyzers now flow in transitively and flag existing test code.FakeOrigincan skip recording requests (so it doesn't hold the request bodies the tests measure) and gets/abortand/delay/{ms}endpoints.Testing
DevProxy.Integration.Tests(187 passed, 2 skipped) andDevProxy.Tests(179 passed) suites pass.WeakReferences rather than timing; the hot-reload test rewrites the config file until the watcher fires (up to 10 times, 3 s apart) to tolerate file-watcher differences.dotnet restore DevProxy.sln --locked-modepasses.