Repository navigation
Conversation
Keep the redirector reusable when capture stops, but close and await its native tasks before interpreter teardown. Run cleanup on interrupted startup too, after cancelling and joining the Python startup tasks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0822dee1-89da-4338-994f-bf1a11052c0e
Only invoke Master.done() after running() has been called. On earlier shutdown, clean up the proxy directly so cached native tasks still finish without invoking uninitialized console UI teardown. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0822dee1-89da-4338-994f-bf1a11052c0e
Run explicit proxy shutdown before frontend and addon teardown. Shield cleanup from repeated cancellation, join pending mode updates, and preserve listener ownership when mode changes are interrupted. Avoid creating unowned startup coroutines before notifications, release cancelled redirector startup reservations, and propagate shutdown failures. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0822dee1-89da-4338-994f-bf1a11052c0e
5 tasks done
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cfacfee1-d3e5-4b4d-9b9f-2712008a29e6
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
Local mode deliberately keeps its native redirector cached when capture stops, to avoid repeated permission prompts. But the cached server is never explicitly closed on final shutdown. Its Rust tasks invoke Python callbacks and logging, so they should finish before interpreter teardown rather than relying on destruction during teardown.
On final shutdown, cancel and await pending mode updates, close listeners, and await the cached redirector before frontend/addon teardown. Preserve capture stop/start reuse, retain listener ownership when a mode change is interrupted, and shield cleanup from further cancellation. Cleanup also runs during interrupted startup, without tearing down an uninitialized console UI; shutdown failures propagate instead of being swallowed by addon hooks.
Complements mitmproxy/mitmproxy_rs#329, which joins native connection handlers when the server shuts down.
Checklist