Skip to content

Commit

Permalink
Unpin channels-redis (#15329)
Browse files Browse the repository at this point in the history
* unpin channels-redis

The bug that initially caused the upgrade block has been resolved django/channels_redis#332

* replace aioredis Exception with a redis Exception

Version 4.0.0 of channel-redis migrated the underlying Redis library from aioredis to redis-py. The Exception has been changed to an equivalent

* remove unused license

* remove UPGRADE BLOCKER in README

* remove hiredis

it was an indirect dependency from aioredis which was removed

* remove unused license

* add back hiredis

it's potentially providing a performance boost. install explicitly as a part of redis. upgrade to more recent version

* remove UPGRADE BLOCKER for hiredis

it was also addressed as a part of this PR
  • Loading branch information
jessicamack authored Aug 7, 2024
1 parent 6d0c47f commit 37b7a69
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 55 deletions.
4 changes: 2 additions & 2 deletions awx/main/wsrelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import aiohttp
from aiohttp import client_exceptions
import aioredis
import redis

from channels.layers import get_channel_layer

Expand Down Expand Up @@ -199,7 +199,7 @@ async def run_producer(self, name, websocket, group):
return

continue
except aioredis.errors.ConnectionClosedError:
except redis.exceptions.ConnectionError:
logger.info(f"Producer {name} lost connection to Redis, shutting down.")
return

Expand Down
22 changes: 0 additions & 22 deletions licenses/aioredis.txt

This file was deleted.

18 changes: 0 additions & 18 deletions requirements/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,24 +120,6 @@ in the top-level Makefile.

If modifying this library make sure testing with the offline build is performed to confirm it is functionally working.

### channels-redis

Due to an upstream bug (linked below), we see `RuntimeError: Event loop is closed` errors with newer versions of `channels-redis`.
Upstream is aware of the bug and it is likely to be fixed in the next release according to the issue linked below.
For now, we pin to the old version, 3.4.1

* https://github.com/django/channels_redis/issues/332
* https://github.com/ansible/awx/issues/13313

### hiredis

The hiredis 2.1.0 release doesn't provide source distribution on PyPI which prevents users to build that python package from the
sources.
Downgrading to 2.0.0 (which provides source distribution) until the channels-redis issue is fixed or a newer hiredis version is
available on PyPi with source distribution.

* https://github.com/redis/hiredis-py/issues/138

## Library Notes

### pexpect
Expand Down
5 changes: 2 additions & 3 deletions requirements/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ azure-keyvault
boto3
botocore
channels
channels-redis==3.4.1 # see UPGRADE BLOCKERs
channels-redis
cryptography>=41.0.7 # CVE-2023-49083
Cython<3 # due to https://github.com/yaml/pyyaml/pull/702
daphne
Expand All @@ -29,7 +29,6 @@ djangorestframework-yaml
filelock
GitPython>=3.1.37 # CVE-2023-41040
grpcio<1.63.0 # 1.63.0+ requires cython>=3
hiredis==2.0.0 # see UPGRADE BLOCKERs
irc
jinja2>=3.1.3 # CVE-2024-22195
JSON-log-formatter
Expand Down Expand Up @@ -60,7 +59,7 @@ receptorctl
social-auth-core[openidconnect]==4.4.2 # see UPGRADE BLOCKERs
social-auth-app-django==5.4.0 # see UPGRADE BLOCKERs
sqlparse>=0.4.4 # Required by django https://github.com/ansible/awx/security/dependabot/96
redis
redis[hiredis]
requests
slack-sdk
tacacs_plus==1.0 # UPGRADE BLOCKER: auth does not work with later versions
Expand Down
17 changes: 7 additions & 10 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ aiohttp==3.9.5
# twilio
aiohttp-retry==2.8.3
# via twilio
aioredis==1.3.1
# via channels-redis
aiosignal==1.3.1
# via aiohttp
annotated-types==0.6.0
Expand All @@ -30,7 +28,6 @@ asn1==2.7.0
async-timeout==4.0.3
# via
# aiohttp
# aioredis
# redis
attrs==23.2.0
# via
Expand Down Expand Up @@ -88,7 +85,7 @@ channels==3.0.5
# via
# -r /awx_devel/requirements/requirements.in
# channels-redis
channels-redis==3.4.1
channels-redis==4.2.0
# via -r /awx_devel/requirements/requirements.in
charset-normalizer==3.3.2
# via requests
Expand Down Expand Up @@ -201,10 +198,8 @@ grpcio==1.62.2
# via
# -r /awx_devel/requirements/requirements.in
# opentelemetry-exporter-otlp-proto-grpc
hiredis==2.0.0
# via
# -r /awx_devel/requirements/requirements.in
# aioredis
hiredis==3.0.0
# via redis
hyperlink==21.0.0
# via
# autobahn
Expand Down Expand Up @@ -449,8 +444,10 @@ pyzstd==0.15.10
# via -r /awx_devel/requirements/requirements.in
receptorctl==1.4.4
# via -r /awx_devel/requirements/requirements.in
redis==5.0.1
# via -r /awx_devel/requirements/requirements.in
redis[hiredis]==5.0.1
# via
# -r /awx_devel/requirements/requirements.in
# channels-redis
referencing==0.33.0
# via
# jsonschema
Expand Down

0 comments on commit 37b7a69

Please sign in to comment.