Issue 32410: Implement loop.sock_sendfile method

Created on 2017-12-22 13:07 by asvetlov, last changed 2018-05-29 01:42 by ned.deily. This issue is now closed.

Messages (7) msg308932 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2017-12-22 13:07
The method should be low-level coroutine, implemented on loops with native sendfile support only (UnixEventLoop).

The signature should be close to socket.sendfile() method

Next step is implementing loop.sendfile(transport, ...) with fallback to sending by chunks if sendfile is not supported.
msg310098 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-01-16 17:59
New changeset 6b5a27975a415108a5eac12ee302bf2b3233f4d4 by Andrew Svetlov in branch 'master':
bpo-32410: Implement loop.sock_sendfile() (#4976)
https://github.com/python/cpython/commit/6b5a27975a415108a5eac12ee302bf2b3233f4d4
msg310279 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-01-19 18:04
New changeset 7464e87a6511d3626b04c9833a262a77b1f21e23 by Andrew Svetlov in branch 'master':
bpo-32410: Make SendfileNotAvailableError exception public (#5243)
https://github.com/python/cpython/commit/7464e87a6511d3626b04c9833a262a77b1f21e23
msg310521 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-01-23 20:19
Andrew, test_cancel2 test fails 1 out of 10 times on my machine (log below).  Could you please take a look?

Also, can you rename sendfile tests to 'test_sock_sendfile_*'?


{pydev} ~/d/p/cpython (master %) ยป ./python.exe -m test test_asyncio -v -m test_cancel2
== CPython 3.7.0a4+ (heads/master:9d411c119f, Jan 23 2018, 15:12:10) [Clang 9.0.0 (clang-900.0.39.2)]
== Darwin-17.3.0-x86_64-i386-64bit little-endian
== cwd: /Users/yury/dev/pydev/cpython/build/test_python_65406
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 1.80 [1/1] test_asyncio
test_cancel2 (test.test_asyncio.test_unix_events.SelectorEventLoopUnixSockSendfileTests) ... ERROR

======================================================================
ERROR: test_cancel2 (test.test_asyncio.test_unix_events.SelectorEventLoopUnixSockSendfileTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/yury/dev/pydev/cpython/Lib/test/test_asyncio/test_unix_events.py", line 487, in cleanup
    proto.transport.close()
AttributeError: 'NoneType' object has no attribute 'close'

----------------------------------------------------------------------
Ran 1 test in 0.010s

FAILED (errors=1)
Task was destroyed but it is pending!
task: <Task pending coro=<BaseSelectorEventLoop._accept_connection2() done, defined at /Users/yury/dev/pydev/cpython/Lib/asyncio/selector_events.py:200> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x10731c2e8>()]>>
test test_asyncio failed
test_asyncio failed
msg310624 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2018-01-24 19:40
New changeset 0a5e71b4c70aab87125a54d7a59765e18d7583a4 by Andrew Svetlov in branch 'master':
bpo-32410: Improve sock_sendfile tests (#5294)
https://github.com/python/cpython/commit/0a5e71b4c70aab87125a54d7a59765e18d7583a4
msg317936 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2018-05-28 22:31
New changeset 7165754b6b5f3b7c07050d921fa1c58bba5f0ff1 by Yury Selivanov in branch 'master':
bpo-32410: Avoid blocking on file IO in sendfile fallback code (GH-7172)
https://github.com/python/cpython/commit/7165754b6b5f3b7c07050d921fa1c58bba5f0ff1
msg317973 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-05-29 01:42
New changeset 420092e255389008b399efa61db300fe44356ee8 by Ned Deily (Miss Islington (bot)) in branch '3.7':
bpo-32410: Avoid blocking on file IO in sendfile fallback code (GH-7172) (#7182)
https://github.com/python/cpython/commit/420092e255389008b399efa61db300fe44356ee8
History Date User Action Args 2018-05-29 01:42:47ned.deilysetnosy: + ned.deily
messages: + msg317973
2018-05-28 22:33:09miss-islingtonsetpull_requests: + pull_request6817 2018-05-28 22:31:57yselivanovsetmessages: + msg317936 2018-05-28 20:21:30yselivanovsetpull_requests: + pull_request6807 2018-01-24 19:42:42asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved 2018-01-24 19:40:38asvetlovsetmessages: + msg310624 2018-01-24 08:50:58asvetlovsetstage: resolved -> patch review
pull_requests: + pull_request5141 2018-01-23 20:19:20yselivanovsetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg310521
2018-01-19 18:06:38asvetlovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved 2018-01-19 18:04:31asvetlovsetmessages: + msg310279 2018-01-19 14:07:11giampaolo.rodolasetnosy: + giampaolo.rodola
2018-01-19 12:37:54asvetlovsetpull_requests: + pull_request5088 2018-01-16 17:59:38asvetlovsetmessages: + msg310098 2017-12-22 13:08:47asvetlovsetkeywords: + patch
stage: patch review
pull_requests: + pull_request4866 2017-12-22 13:07:13asvetlovcreate