Skip to content

asyncio.open_connection happy_eyeballs_delay leaves refcycles with exception tracebacks #124858

Closed

Description

@graingert

Bug report

Bug description:

import asyncio
import gc
import objgraph
import weakref

async def amain():
    exc = None
    try:
        await asyncio.open_connection(
            host="localhost", port=8080, happy_eyeballs_delay=0.25
        )
    except* OSError as excs:
        exc = excs.exceptions[0]
    assert exc is not None
    print(gc.get_referrers(exc))

asyncio.run(amain())

should be empty but you get a bunch of exceptions lists:

[[ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 8080)")], [ConnectionRefusedError(111, "Connect call failed ('127.0.0.1', 8080)")]]

CPython versions tested on:

3.12, 3.13, CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added a commit that references this issue on Oct 2, 2024
  2. added 2 commits that reference this issue on Oct 2, 2024
  3. added 2 commits that reference this issue on Oct 23, 2024
  4. moved this from Todo to Done in asyncioon Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions