tools: Previous response not closed before retry — connection pool can leak under sustained 429/5xx

Open Beginner friendly
#63 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
networking

Research direction

Open src/entrabot/tools/rate_limit.py and inspect handle_async_request around lines 62-107, focusing on the retry loop and the prior httpx response. Confirm how responses are released before another request is issued. Done means each retry closes or consumes the previous response so sustained 429/5xx traffic does not retain connections in the pool.

Written by the indexing model from the issue text.

Description

bug

File: src/entrabot/tools/rate_limit.py
Location: handle_async_request (L62-L107)
Category: leak
Priority: low

Description

On each retry the loop reassigns response without aclose() / aread() on the prior one. httpx returns the underlying connection to the pool only after the response is consumed or GC'd; under sustained 429 or 5xx traffic this can cause pool starvation.

Suggested fix

await response.aread() (or aclose()) immediately before issuing the retry request.


Filed automatically by a thorough code-review pass over src/entrabot/ on 2026-06-13. Internal review id: #58.

Dominant language
Python
Stars
9
Forks
6
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/entrabot

All issues in microsoft/entrabot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.