fix(validator): close MirrorClient session opened for issue discovery#1476
Open
jaso0n0818 wants to merge 1 commit into
Open
fix(validator): close MirrorClient session opened for issue discovery#1476jaso0n0818 wants to merge 1 commit into
jaso0n0818 wants to merge 1 commit into
Conversation
issue_discovery() called run_issue_discovery() without a client, so the `client = client or MirrorClient()` fallback inside it created a new MirrorClient — and its requests.Session — that was never closed. Issue discovery runs every scoring round, so each round leaked the session's connection pool. Own the client at the call site with `with MirrorClient() as client:` and pass it in, mirroring how forward.build_maintainer_uids_by_repo and reward.evaluate_miner already manage their MirrorClient lifetime.
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.
Summary
issue_discovery()(gittensor/validator/forward.py) calledrun_issue_discovery()without aclient, so theclient = client or MirrorClient()fallback inside it created a newMirrorClient— and its underlyingrequests.Session— that was never closed. Issue discovery runs on every scoring round, so each round leaked the session's connection pool (open sockets).This owns the client at the call site with
with MirrorClient() as client:and passes it in, mirroring howforward.build_maintainer_uids_by_repoandreward.evaluate_mineralready manage theirMirrorClientlifetime. No behavior changes beyond the session now being released.Related Issues
No issue filed; self-contained resource-leak fix on the issue-discovery path, in the same vein as the per-PR content cleanup in #1456.
Type of Change
Testing
Full gate run locally with
uv(Python 3.12):No CLI output is affected (change is in
gittensor/validator/**, notgittensor/cli/**), so no terminal evidence applies.Checklist
with MirrorClient() as client:pattern in this file)uv run pytest tests/— 917 passed) and pyright clean