Skip to content

Warning at startup: "No registered callback for token renewal task. Renewal cancelled" #3650

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

Open
tomdug opened this issue May 21, 2025 · 2 comments

Comments

@tomdug
Copy link

tomdug commented May 21, 2025

We're seeing the following warning at startup when using a StreamingCredentialProvider (in particular EntraIdCredentialsProvider from redis-py-entraid):

No registered callback for token renewal task. Renewal cancelled

Token renewal seems to work normally, so it looks like a false positive that clutters the logs.

Looking into the implementation, the warning comes from the _renew_token_async method in the TokenManager, where self._listener.on_next is initially None. The EntraIdCredentialsProvider creates a CredentialsListener instance at init, and only later sets on_next via the .on_next() method.

This means the token renewal task may start before the callback is set, causing the warning. This only occurs during startup and appears to resolve itself later, presumably once the callback is registered.

Let me know if you need more information

Thanks!

@vladvildanov
Copy link
Collaborator

Thanks for reaching out! On my way on this

@vladvildanov
Copy link
Collaborator

@tomdug You're right that potentially the renewal may start before the callback is set, but the way how it currently works it shouldn't:

  1. When the ConnectionPool was created by client, it fires an event that triggers callback set on_next(callback).
    https://github.com/redis/redis-py/blob/master/redis/asyncio/client.py#L361

  2. When the connection is picked from created pool and performs handshake it calls await cred_provider.get_credentials_async() which triggers renewal process. And at this point we already should have a callback set.
    https://github.com/redis/redis-py/blob/master/redis/asyncio/connection.py#L369

Would you be able to provide more information? Do you see the way it could be started before callback was set?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants