Skip to content

LoopCommunicator: RuntimeWarning: coroutine 'create_task.<locals>.run_task' was never awaited #211

@chrisjsewell

Description

@chrisjsewell

I've seen this quite a few times now in unit tests, for example in aiidateam/aiida-core#4775 (comment)
This coroutine is created in plumpy.futures.create_task, which is called by plumpy.communicator.convert_to_comm, that is used when adding an rpc/task/broadcast subscriber in plumpy.communicator.LoopCommunicator.

It is weird that it should say it was not awaited, because it is wrapped in asyncio.run_coroutine_threadsafe(run_task(), loop), so you would think that it should always be awaited.

Is this just because the loop is closed while run_task() is running (I guess these tasks should run forever until the subscriber is removed), or does it point to a deeper problem?
Could LoopCommunicator.close ensure such tasks are stopped gracefully, e.g. by ensuring all subscribers are removed.

cc @unkcpz

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions