Title: asyncio: sendfile tests ignore SO_SNDBUF on Windows
Type: enhancement Stage: resolved
Components: asyncio, Tests, Windows Versions: Python 3.8
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, paul.moore, steve.dower, tim.golden, vstinner, yselivanov, zach.ware
Priority: normal Keywords:

Created on 2018-05-29 14:07 by vstinner, last changed 2018-09-19 23:56 by vstinner. This issue is now closed.

Messages (2)
msg318031 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-29 14:07
Follow-up of bpo-33353: On my PR 7200, test_sendfile_close_peer_in_the_middle_of_receiving() failed on Windows (AppVeyor) :-(

For the SelectorEventLoop, it seems like sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 1024) doesn't work as intented: sock.send(<16384 bytes>) returns 16384, as the 1024 limit is not taken in account :-(

Same issue for the ProactorEventLoop...

I'm not sure if it's a bug in asyncio, a bug (limitation) of Windows which ignores SO_SNDBUF, or something else...
msg318034 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-29 14:08
The failure was:

FAIL: test_sendfile_close_peer_in_the_middle_of_receiving (test.test_asyncio.test_events.ProactorEventLoopTests)
Traceback (most recent call last):
  File "C:\projects\cpython\lib\test\test_asyncio\", line 2506, in test_sendfile_close_peer_in_the_middle_of_receiving
AssertionError: False is not true : 65536


In bpo-33353, I worked around the bug in my commit 9551f7719213243fd96c4f284079243773c26b3c by using a buffer of 128 KiB instead of 64 KiB.
Date User Action Args
2018-09-19 23:56:26vstinnersetstatus: open -> closed
resolution: out of date
stage: resolved
2018-05-29 14:08:59vstinnersetmessages: + msg318034
2018-05-29 14:07:11vstinnercreate