Repository navigation
Restore --timeout / timeoutSeconds inactivity shutdown - #1993
Open
waldekmastykarz wants to merge 1 commit into
Open
waldekmastykarz wants to merge 1 commit into
waldekmastykarz wants to merge 1 commit into
Conversation
…#1952 The inactivity timer lost its caller in the Kestrel engine migration, so --timeout / timeoutSeconds were parsed but had no effect. The Kestrel engine now starts the timer after binding, resets it on every incoming proxy request, and stops the host when it elapses. Aligns the v4.0.0 schema description with the CLI help. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e38816bc-97d1-40e5-adbb-4ef31390511d
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Timer startup timing, expiry/reset synchronization, and unsupported timeout values can cause premature shutdown or startup failure.
1 open issue
What changed in this PR
Restores inactivity shutdown for --timeout / timeoutSeconds in the Kestrel proxy engine, addressing #1952.
Changes:
- Connects request activity and host shutdown to the inactivity timer.
- Adds idle-timeout and countdown-reset integration tests.
- Aligns the schema description with CLI help.
| File | Description |
|---|---|
| schemas/v4.0.0/rc.schema.json | Clarifies inactivity timeout behavior. |
| DevProxy/Extensions/IServiceCollectionExtensions.cs | Supplies host lifetime to the engine. |
| DevProxy.Proxy.Kestrel/KestrelProxyEngine.cs | Connects timeout expiry to shutdown. |
| DevProxy.Proxy.Kestrel/Internal/ProxyConnectionHandler.cs | Reports incoming request activity. |
| DevProxy.Proxy.Kestrel/Internal/InactivityTimer.cs | Relocates timer and handles resets after disposal. |
| DevProxy.Integration.Tests/EngineInactivityTimeoutTests.cs | Adds timeout regression coverage. |
Review effort: Balanced
Comment on lines
+71
to
+72
| using var inactivityTimer = configuration.TimeoutSeconds is { } timeoutSeconds && hostApplicationLifetime is not null | ||
| ? new InactivityTimer(timeoutSeconds, () => |
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.

Closes #1952
--timeout/timeoutSecondswere parsed but never used:InactivityTimerlost its caller in the Kestrel engine migration (9a15447), so Dev Proxy never exited after inactivity.Changes
InactivityTimerintoDevProxy.Proxy.Kestreland madeResetsafe against a shutdown race.KestrelProxyEnginetakes an optionalIHostApplicationLifetime. WhenTimeoutSecondsis set, it starts the timer after binding, resets it on every incoming proxy request (including CONNECT and keep-alive requests), and callsStopApplicationwhen the timer elapses.IHostApplicationLifetimeto the engine.rc.schema.jsondescription to match the CLI help: "Time in seconds after which Dev Proxy exits. Resets when Dev Proxy intercepts a request."The docs (proxy-settings.md) still call the key
timeout. That needs a separate fix in the docs repo.Testing
EngineInactivityTimeoutTests: the proxy stops when idle, doesn't stop without a timeout, and requests reset the countdown.DevProxy.Integration.Tests(96) andDevProxy.Proxy.Kestrel.Tests(203) pass.devproxy --timeout 3logs "No requests received in 3 seconds. Stopping Dev Proxy..." and exits.