Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while reading from socket: (11, 'Resource temporarily unavailable') #1

Closed
n00b-bot opened this issue Aug 8, 2022 · 0 comments

Comments

@n00b-bot
Copy link
Owner

n00b-bot commented Aug 8, 2022

While developing, I face this error. After searching, I found https://bytemeta.vip/repo/andymccurdy/redis-py/issues/1387?page=1 to fix it.

Sumary

On most platforms, BlockingIOError is raised with an errno.EWOULDBLOCK error number. But Jypthon(on Windows) uses a different error to indicate that the socket would block which is errno.EAGAIN error number.
NONBLOCKING_EXCEPTIONS tuple only have errno.EWOULDBLOCK on the whitelist.
image
But the error is errno.EAGAIN , so the if condition is false and then raise ConnectionError
image

Solution

Add the errno.EAGAIN to the whitelist only once.

import errno
import socket
from redis import connection
connection.NONBLOCKING_EXCEPTION_ERROR_NUMBERS[socket.error] = errno.EAGAIN
connection.NONBLOCKING_EXCEPTIONS = tuple(connection.NONBLOCKING_EXCEPTION_ERROR_NUMBERS.keys())
@n00b-bot n00b-bot closed this as completed Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant