django / channels_redis

Redis channel layer backend for Django Channels
BSD 3-Clause "New" or "Revised" License
601 stars 197 forks source link

Connection reset by peer when upgrading redis-py to v5 #373

Closed vsobotka closed 10 months ago

vsobotka commented 1 year ago

Not sure if this is a bug or not, just wanted to share an issue we encountered with others. Earlier this year we upgraded redis-py for our app on Heroku from 3.9 to 4.5.4. We immediately ran into #235 and had to place in a workaround, with the ssl context. Everything went fine, until now, when we upgraded redis-py again, to 5.0.1. We immediately got "Connection reset by peer" error, preventing a stable connection. I was not able to find anything that would help. What helped us was to remove the workaround from #235 and use the newly supported option ssl_cert_reqs in layer config. So far this looks like it works perfectly well.

carltongibson commented 1 year ago

Thanks @vsobotka. Do you think there's a good reference to point folks to for the changes in redis-py?

vsobotka commented 1 year ago

@carltongibson No idea really. I was searching all over the place, mostly in redis related packages in our project and their GitHubs. Probably making an explicit note in #235 would inform people using this workaround that it's only good until they upgrade.

toniengelhardt commented 1 year ago

I'm getting a lot of system exists that seem to be related to redis (but not sure).

Just wanted to check if channels-redis==4.1.0 is supposed to work with redis==5.0.1 or if I should rather downgrade to a 4.x version, and if yes, which one?

Screenshot 2023-10-28 at 22 28 51
carltongibson commented 1 year ago

@toniengelhardt Good question. redis-py has been charging forward under us, and (for life reasons) I haven't had a chance to catch up with the exact state of play.

If you were to run the tests against each version, and report back, that would give us the base to clarify the advice. (If we need to we can pin channels-redis until we can adjust to update.)

toniengelhardt commented 1 year ago

@carltongibson unfortunately, I'm also more than busy with multiple projects, but I will downgrade to a redis 4.x version and see if that makes the errors go away and report back.

carltongibson commented 10 months ago

377 added explicit testing against multiple redis-py versions:

 redis46: redis>=4.6,<4.7
 redis50: redis>=5.0,<5.1
 redismain: https://github.com/redis/redis-py/archive/master.tar.gz

Any of those should work.