Closed kozlovsky closed 2 months ago
The reason for the bug:
ProactorEventLoop
uses WSASendTo
and WSARecvFrom
API calls to send a UDP datagram.WSASendTo
sends a packet to an unreachable client, it gets an ICMP unreachable message.WSARecvFrom
receives OSError
"[WinError 1234] No service is operating at the destination network endpoint on the remote system". IocpProactor
falsely believes the error is related to reading the new datagram. After that, the server logic breaks, and it stops executing further callbacks.
It is possible to have the following situation of Windows with ProactorEventLoop easily:
connection_made
,datagram_received
,error_received
, andconnection_lost
) until restarted.The following is an example that reproduces the bug:
server.py
client.py
You can run "server.py" and check that after receiving the message from the first client, all other clients are ignored, and the server hangs.
See CPython issues #88906, #91227
The issue was fixed three weeks ago in the main Python branch and will be included in the subsequent releases for Python 3.11 and 3.12.
I backported the fix to Python 3.8 and above; I am preparing the PR now.