Skip to content

integrations: aioredis creates coroutines that do not execute for sync operations #623

@vishal-wadhwa

Description

@vishal-wadhwa

Description

In order to record Redis database transactions via aioredis client library, we upgraded the newrelic python agent from v7.4.0.172 to v7.16.0.178

Service degradation was observed as the update was rolled out in production.
The cause was that the newrelic wrapped aioredis functions for Pipelines were failing to execute.

To me, it seems that the new aioredis integration is wrapping all of the functions with async and effectively returning a coroutine while the original implementation returns an Awaitable (Pipeline) always, that need not be awaited immediately.

Since aioredis supports both sync and async callbacks in the transaction function, the newrelic package should too.

Refer to the reproducible example below.

Expected Behavior
All functions to work the same as without newrelic integrations. The functionality should not break.

Troubleshooting or NR Diag results
This log was printed to stderr when aioredis pipeline set was used in a transaction.

RuntimeWarning: coroutine '_wrap_AioRedis_method_wrapper.<locals>._nr_wrapper_AioRedis_method_' was never awaited 

Steps to Reproduce
Instructions and repro here -
https://gist.github.com/vishal-wadhwa/337ff7c7e3146ede0849cbbbfff107b0

Your Environment
Not relevant. Reproducible in all environments.

Additional context
NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect or flawed agent behavior.needs-triageRequires initial review by maintainers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions