-
Notifications
You must be signed in to change notification settings - Fork 336
ConnectionResetError: [Errno 104] Connection reset by peer #778
Comments
i had the same ConnectionResetError |
Can you please check out the latest master and test with that? Note that as of #891 the client has the same API as redis-py. |
getting a few thousand of these a day when using Django Channels |
This error still exists in |
i had the same ConnectionResetError |
from my test, when this occured, aioredis / redis-py / asyncio-redis cann't connect, but aredis can do, what is the difference in it? |
Hi all, the problem lies with the |
Any workaround found for this issue ? |
Same issue here in production. There's a firewall resetting connections after some time, and aioredis won't recover from this, which is a serious problem. Is there any known workaround? |
Please, consider this issue in #1225. |
This issue can be closed, it should've been solved with #1129. |
No, sorry, it doesn't solve this issue. Quick test:
$ docker run --rm -d -p 6379:6379 --name redis redis
from aioredis import Redis
import asyncio, time
redis = Redis()
loop = asyncio.get_event_loop()
loop.run_until_complete(redis.set("something", "something"))
while True:
print(loop.run_until_complete(redis.get("something")))
time.sleep(5)
$ sudo ss -K dst [::1] dport = redis
So we switched error messages, but the issue persists. |
A workaround would be to call |
@Enchufa2 thanks for running the test. What do you mean automagically? Is there code that they implement that we somehow missed or code that we did port that is not functioning properly? Does internal connection not handle this properly? |
I mean that |
@Enchufa2 can you change this: to Redis is checking using |
Nope, this doesn't help, same error. By the way, I noticed that I switched the errors coming from the current release and the current master branch in my previous comment. Apologies, the comment is amended now. |
This is interesting. It turns out I had |
Reported in redis/redis-py#1772 |
@Enchufa2 I'm unable to reproduce this error in both redis main/master branch and aioredis==2.0.0. https://github.com/Andrew-Chen-Wang/aioredis-issue-778 unlike |
If I use
|
We were also seeing this in production with @Andrew-Chen-Wang I see you were unable to reproduce, is there any current plan to look into this further? Or would you like someone to put together a PR with a potential fix? |
@cjdsellers I still can't reproduce this issue, so a PR is much appreciated as we're down a maintainer now and I'm stuck with work. |
No, it's
|
@Enchufa2 ok I didn't think it was that as we implemented all call_with_retry, but, as it turns out, in the port, we forgot to await the fail/disconnect call in |
We're still in the same spot with those changes:
Now I'm a bit lost. How does a |
Take a look at what Retry is set to in your connection object: https://github.com/aio-libs/aioredis-py/blob/cb93ef4a6fa80f3d32d78aced58d8df196aa58e1/aioredis/connection.py#L629 In the stack trace, it did fail. My guess is you had retry_on_timeout implemented so you got 1 retry. Retry performed the send command function again. I guess what I wouldn't understand is whythe exception still wasn't caught. Maybe the Rrtry class also needs to catch OSError? Probably using a debugger would be helpful to catch whether the disconnected connection was being reused? |
Were you able to reproduce the error? If not, I think we should focus on that first. :) You need to find a way to reset or abort a TCP connection in macOS, or otherwise, test this into a Linux box, where you can use I just tried $ sudo tcpkill -i lo port 6379 Here |
Seems like you guys are really close to a solution on this? Thank you for all the effort here! |
Now that Aioredis is in redis-py 4.2.0rc1, is the expectation that this issue will go away once we migrate to |
Still actual File "aioredis/client.py", line 1082, in execute_command
conn = self.connection or await pool.get_connection(command_name, **options)
File "aioredis/connection.py", line 1422, in get_connection
if await connection.can_read():
File "aioredis/connection.py", line 893, in can_read
return await self._parser.can_read(timeout)
File "asyncio/streams.py", line 665, in read
raise self._exception
ConnectionResetError: [Errno 104] Connection reset by peer |
@Andrew-Chen-Wang |
i've lost a severe amt of time to work so not sure when it'll be ported over. Maybe sometime in June unless someone else would like to help out. Anyone can help! |
Hi @Andrew-Chen-Wang could you point me in the direction of the changes that need to be ported over? We have currently disabled connection pooling due to the stability issues, and it definitely has introduced a performance overhead. |
hi @steve-marmalade please head over to redis/redis-py to ask this question. I'm fairly busy lately, but I'll try to answer when I find the time. Sorry! edit sorry! I shoulda looked at this more carefully |
@chayim do you think you can port over the PR that fixed this issue? Thanks! |
Gentle bump @Andrew-Chen-Wang , @chayim |
Just use main redis library. This issue is not occurs there. |
@Andrew-Chen-Wang what do you think of our (me) finding ways to move bugs between repos... let's say specific items? |
@Olegt0rr , can you expand on:
We still see intermittent ConnectionErrors when using
So I thought I was not alone in feeling that this issue hasn't been resolved in the other redis library. |
I use redis-py async commands, and I had to write a simple wrapper to "retry" connection resets :
|
@chayim I don't think we can transfer issues between orgs, and even if that's possible, I don't have the perms to do so. What we could try to do is create new issues in redis-py that carries on conversation from aioredis. We'd lock those aioredis issues and leave a comment saying to go to the redis-py repo. We can also add two labels: aioredis-native and redis-py. It's a bit manual though, but I guess that's the prob with migrations. Thoughts? |
@Andrew-Chen-Wang here are my thoughts, if you're game:
WDYT? |
@chayim sounds great except I promised, when I had the time at least, that I'd revert aioredis to its original v1 form. Archiving would defeat the purpose of seeing if anyone preferred the old pkg. I think points 1 and 3 are good enough. I don't see much activity on aioredis anymore anyways since most people see the migration note. I'll also add the migration note to the docs since people might be navigating there as well. Beside pt 2, it all sounds good with me! |
any workaround so far?
|
Hi, everybody!
I use torando+aioredis, and recently i met this issue, below is traceback
my environ: aioredis==1.2.0 tornado==5.1.1
I use this method
aioredis.create_redis_pool(**args)
to create poolcan anybody show me help? thx a lot.
The text was updated successfully, but these errors were encountered: