Skip to content

Keep mitmdump running until concurrent client replays finish - #8525

Closed
hakarrr wants to merge 5 commits into
mitmproxy:mainfrom
hakarrr:fix/count-concurrent-client-replays
Closed

hakarrr wants to merge 5 commits into
mitmproxy:mainfrom
hakarrr:fix/count-concurrent-client-replays

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Description

Include active replay_tasks in replay.client.count, alongside the queue and serial in-flight request.

With client_replay_concurrency=-1, the playback worker removes requests from the queue as soon as it starts their tasks. The count can then become zero while those tasks still wait for responses. KeepServing uses this command to decide when mitmdump can stop, and replay connections are not tracked in Proxyserver.connections.

The change keeps mitmdump running until these replays finish. It does not change concurrency limits or cancellation behavior.

Tests cover one and three blocked concurrent tasks, plus a real localhost TCP server that holds its response. The TCP test checks both serial and unlimited modes, the command result, KeepServing.keepgoing(), and completion returning the count to zero.

Validation on main 3f81168:

  • Addons suite: 543 passed, 1 skipped.
  • Core test/mitmproxy suite: 2022 passed, 2 skipped, 1 environment failure creating a TUN device. That same TUN test fails on unchanged source.
  • uv run tox -e lint: passed.
  • Focused Ruff formatting: passed.

Checklist

  • I have updated tests where applicable.
  • I have added an entry to the CHANGELOG.

hakarrr and others added 5 commits October 26, 2026 01:42
Keep in-flight unlimited-concurrency replay tasks visible to KeepServing.

Co-authored-by: generaltony007 <[email protected]>
Cover blocked replay tasks and held localhost responses in serial and unlimited modes.

Co-authored-by: generaltony007 <[email protected]>
@hakarrr

hakarrr commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Could a maintainer give this concurrent client-replay lifetime fix a human review and advise on the next step? Please let me know if changes are needed or if you'd prefer this PR closed. Thanks.

@hakarrr hakarrr closed this Nov 17, 2026
@hakarrr
hakarrr deleted the fix/count-concurrent-client-replays branch November 25, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant