-
Notifications
You must be signed in to change notification settings - Fork 336
ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。 #1121
Comments
the error stack is :
|
See #778. |
Hi all, the problem lies with the |
@eneloop2 please create a PR or gist to demonstrate the fix. Greatly appreciated investigation! |
Hey @Andrew-Chen-Wang, I'm not sure how you guys want to fix it since I'm not sure about the motivation behind subclassing |
@eneloop2 this is just a port from redis-py, so the only original motivation behind it was that we copied code. Besides that, I guess it would make more sense to solely subclass RedisError as a specific exception to our library. |
This is incorrect - with multiple inheritance, a class is a subclass of both parent classes. class MyException(Exception): ...
class SomeException(ConnectionError, MyException): ...
print(issubclass(SomeException, ConnectionError))
print(issubclass(SomeException, MyException))
try:
raise SomeException("ack!")
except MyException as e:
print(e)
try:
raise SomeException("agh!")
except ConnectionError as e:
print(e)
#> True
#> True
#> ack!
#> agh! |
No, your example is wrong. Because that's not how |
Look and see which |
What does this print? This is exactly what's going on in |
@Andrew-Chen-Wang maybe you should look this issue and patch from redis-py project. and try this demo. from aioredis.connection import NONBLOCKING_EXCEPTIONS
try:
raise ConnectionResetError
except NONBLOCKING_EXCEPTIONS:
print('aioredis catched!')
except Exception as exc:
print("aioredis not catched!")
from redis.connection import NONBLOCKING_EXCEPTIONS
try:
raise ConnectionResetError
except NONBLOCKING_EXCEPTIONS:
print('redis-py catched') output:
add |
For an updated reference to the commit, see redis/redis-py@f0516c9. I think this was not ported over in the migration and should be. @Andrew-Chen-Wang can we get #1129 in the #1156 update PR? |
idk what happend, but it dosen't work suddenly.
i guarantee redis server is ok and i try other redis lib it works too,
i am use version:
aioredis==2.0.0
on Microsoft Windows [Version 10.0.19043.1165]
python 3.9.6
The text was updated successfully, but these errors were encountered: