azure-sdk-for-python: coroutine was never awaited

  • Operating System: linux
  • Python Version: 3.8.8

Describe the bug

On termination we get sys:1: RuntimeWarning: coroutine 'Lock.acquire' was never awaited error message.

Given there is no acquire in our code and we only create tasks, I am assuming some of the async packages are doing so.

To Reproduce I do not have a clear way to reproduce.

Expected behavior Clean exit, no error messages.

Additional context Our code handles graceful termination, i.e. we process SIGTERM to ensure our app shuts down nicely. That means when SIGTERM is received a specific exception is thrown and handled specifically.

My guess is that this exception breaks some library flow, leaving a not still awaited coroutine pending.

Maybe similar to https://github.com/Azure/azure-sdk-for-python/issues/21061

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 42 (20 by maintainers)

Most upvoted comments

hey @andrea-cassioli-maersk , I have been playing with the asyncio lib recently, and I feel it could be not handling asyncio error properly under the situation of “asyncio.wait_for” + interrupt.

I’m still working on getting some simplified code to reproduce the issue first.

@swathipil I cannot really add more logging (especially uamqp that is very verbose…). We have not seen this issue happening for an entire week, so I guess it must be something happening in a very corner case. I have add some more log in our code to see if I can pin down a bit better where that might happen in our code.

@andrea-cassioli-maersk I meant azure-communication-identity, azure-communication-networktraversal, etc.

Are you using these libraries?

Sorry for the confusion.