Skip to content

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

Description

@brandwe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions