You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-10-21.11:26:38.203>created_at=<Date2012-09-20.11:12:49.681>labels= ['type-bug', 'library']
title='asyncore.dispatcher does not handle windows socket error code correctly (namely WSAEWOULDBLOCK 10035)'updated_at=<Date2021-10-21.11:26:38.202>user='https://bugs.python.org/McNetic'
There are some differences between win32 and other os socket implementations. One specific I found is that in windows, non-blocking socket apis will return WSAEWOULDBLOCK or 10035 instead of EWOULDBLOCK.
This causes recv() in asyncore.dispatcher to raise an unhandled exception instead of continuing gracefully.
The fix could maybe be as simple as replacing line 384 in asyncore.py:
data = self.socket.recv(buffer_size)
with
try:
data = self.socket.recv(buffer_size)
except socket.error as e:
if 10035 == e.errno:
pass
else:
raise e
It doesn't look like the fix for issue bpo-16133 fixed this problem, or perhaps it only fixed it for asynchat but not asyncore.
I have attached a patch (against python 2, since this is where I needed it fixed). The patch treats WSA flavors of all errno values in the same way that the non-WSA flavors were treated before.
It is the intent that no direct references to errno values persist after applying this patch. The patch fixed my particular issue, but I certainly haven't tested every new error condition.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: