New submission from STINNER Victor <vstinner@python.org>:
The proactor event loop of asyncio returns b'' on recv_into() if the socket/pipe is closed:
def recv_into(self, conn, buf, flags=0):
...
try:
...
except BrokenPipeError:
return self._result(b'')
...
But a socket recv_into() must always return a number: the number of written bytes. Example with socket.socket.recv_into() method:
https://docs.python.org/3/library/socket.html#socket.socket.recv_into
IMHO zero must be returned here. This bug may be the root cause of bpo-38912 bug.
Attached PR fix the issue.
----------
components: asyncio
messages: 374760
nosy: asvetlov, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: recv_into() must not return b'' if the socket/pipe is closed
versions: Python 3.10
_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41467>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
The proactor event loop of asyncio returns b'' on recv_into() if the socket/pipe is closed:
def recv_into(self, conn, buf, flags=0):
...
try:
...
except BrokenPipeError:
return self._result(b'')
...
But a socket recv_into() must always return a number: the number of written bytes. Example with socket.socket.recv_into() method:
https://docs.python.org/3/library/socket.html#socket.socket.recv_into
IMHO zero must be returned here. This bug may be the root cause of bpo-38912 bug.
Attached PR fix the issue.
----------
components: asyncio
messages: 374760
nosy: asvetlov, vstinner, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: recv_into() must not return b'' if the socket/pipe is closed
versions: Python 3.10
_______________________________________
Python tracker <report@bugs.python.org>
<https://bugs.python.org/issue41467>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com