Skip to content

Erred futures are never descoped #6310

Open
@crusaderky

Description

@crusaderky

This test hangs on the final while loop:

import weakref

@gen_cluster(client=True)
async def test_descope_erred_future(c, s, a, b):
    f = c.submit(lambda: 1 / 0, key="f")
    ref = weakref.ref(f)
    with pytest.raises(ZeroDivisionError):
        await f
    del f
    while ref():
        await asyncio.sleep(0.01)

Additionally, the task never disappears from s.tasks.

Replacing with pytest.raises(ZeroDivisionError): await f with

try:
    await f
except ZeroDivisionError:
    pass

does not change anything.

Replacing with pytest.raises(ZeroDivisionError): await f with await wait(f) makes the issue disappear.

Workaround

Calling f.release() does not solve the client-side leak, but it does remove the future (and all of its graph) from the scheduler and workers.

@sjperkins I believe this may be closely related with what you've been seeing on the scheduler side?

Metadata

Metadata

Assignees

No one assigned

    Labels

    good second issueClearly described, educational, but less trivial than "good first issue".p3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions