Skip to content

Cancellation of the handlers set to the "ready" event of an asyncio component are not properly handled #1123

Open
@rdebroiz

Description

@rdebroiz

After cancelling the handlers associated with the "ready" event a _GatheringFuture exception holding the CancelledError is raised but never retrieved.

@comp.on_ready
async def go(*args, **kwargs):
    while True:
        await asyncio.sleep(1)

run(comp)

gives, after the user initiated a shutdown:

2019-02-22T16:54:47 connecting once using transport type "websocket" over endpoint "tcp"
2019-02-22T16:54:50 Shutting down due to SIGINT
2019-02-22T16:54:50 _GatheringFuture exception was never retrieved
future: <_GatheringFuture finished exception=CancelledError()>
concurrent.futures._base.CancelledError

Just await the handlers solves the issue:

# in autobahn.util.ObservableMixin.fire
for handler in self._listener
    future = txaio.as_future(
    
    def consume_result(fut):
        return fut.result()
    
    future.add_callbacks(consume_result)
    res.append(future)

Related to #1000

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