Skip to content

Crash in _asyncio._swap_current_task due to improper reference counting #105987

Closed
wolfi-dev/advisories
#8607
@chgnrdv

Description

@chgnrdv

First appeared in a474e04, where given function was introduced.

Repro:

import _asyncio

class DummyLoop:
    pass

class DummyTask:
    pass

l = DummyLoop()
_asyncio._swap_current_task(l, DummyTask())
t = _asyncio._swap_current_task(l, None)

Output:

Modules/gcmodule.c:461: visit_decref: Assertion "!_PyObject_IsFreed(op)" failed
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x7fedad081130
object refcount : 1
object type     : 0x55f665a81fe0
object type name: dict
object repr     : Segmentation fault (core dumped)

I'm working on a fix.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic-asynciotype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions