Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Asyncio DaprClient raising "coroutine 'Channel.close' was never awaited" #642

Closed
ivarec opened this issue Nov 24, 2023 · 2 comments
Closed
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@ivarec
Copy link

ivarec commented Nov 24, 2023

Expected Behavior

I'm getting this error in my logs when an asyncio DaprClient exists an async with block:

./dapr/aio/clients/grpc/client.py:172: RuntimeWarning: coroutine 'Channel.close' was never awaited

I haven't perceived any other side effects, but I haven't tested much. Maybe there is a resource leak.

Dapr version: 1.12.0
SDK version: 1.12.0
Python version: 3.9

Actual Behavior

To have DaprClient correctly manage the lifecycle of the channel and close it upon exiting the async with block.

Steps to Reproduce the Problem

Just create an asyncio DaprClient and use it in an async with block.

Also, I've noticed that the bug appears to be caused by this method on ./dapr/aio/clients/grpc/client.py, line 172:

    async def close(self):
        """Closes Dapr runtime gRPC channel."""
        if hasattr(self, '_channel') and self._channel:
            self._channel.close()

There seems to be a missing await on self._channel.close().

Release Note

RELEASE NOTE:

@ivarec ivarec added the kind/bug Something isn't working label Nov 24, 2023
@berndverst
Copy link
Member

I'll patch this up and will add a 1.12.1. I won't bother with updates for 1.11.X and earlier however. The SDK can be used with previous versions of Dapr Runtime, so no concerns there.

@berndverst
Copy link
Member

Fixed in 1.12.1

https://github.com/dapr/python-sdk/releases/tag/v1.12.1

Should be available via PyPI in a few minutes. Build job here:
https://github.com/dapr/python-sdk/actions/runs/7008586040

@berndverst berndverst added this to the v1.12 milestone Nov 27, 2023
@berndverst berndverst self-assigned this Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants