[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread STINNER Victor
STINNER Victor added the comment: > I've checked it, everything works as Victor described. Yeah! That's great when it just works! -- ___ Python tracker ___ __

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Andrew Svetlov
Andrew Svetlov added the comment: My initial thought was that os.sendfile() raises OSError on sending more than 0x7fff_f000 but I was wrong. I've checked it, everything works as Victor described. Thank you guys for the feedback. -- resolution: -> not a bug stage: -> resolved status

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread STINNER Victor
STINNER Victor added the comment: The manual page says: sendfile() will transfer at most 0x7000 (2,147,479,552) bytes, returning the number of bytes actually transferred. (This is true on both 32-bit and 64-bit systems.) I understand that you can pass a larger

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread STINNER Victor
STINNER Victor added the comment: > In that case I think asyncio's sendfile() should simply do the math to > transmit that many bytes by taking into account that os.sendfile() may return > less bytes than requested. The internal sendfile() implementation in asyncio already loops until all by

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread STINNER Victor
STINNER Victor added the comment: os.write(data) can write less than len(data) bytes. It's by contract, as socket.send(data) can send less than len(data). It is used to truncated the length argument to INT_MAX, to be able to cast it to an int on Windows. Extract of _Py_write(): #ifdef MS_WI

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: Do you mean raising an exception if "count" argument is passed and > 2,147,479,552? In that case I think asyncio's sendfile() should simply do the math to transmit that many bytes by taking into account that os.sendfile() may return less bytes than reques

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Andrew Svetlov
Change by Andrew Svetlov : -- nosy: +giampaolo.rodola -ned.deily, ronaldoussoren ___ Python tracker ___ ___ Python-bugs-list mailing

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Andrew Svetlov
Change by Andrew Svetlov : -- components: +Library (Lib), asyncio -macOS nosy: +yselivanov ___ Python tracker ___ ___ Python-bugs-li

[issue35179] Limit max sendfile chunk to 0x7ffff000

2018-11-06 Thread Andrew Svetlov
New submission from Andrew Svetlov : On Linux maximum data size for sendfile call is 0x7000: sendfile() will transfer at most 0x7000 (2,147,479,552) bytes, returning the number of bytes actually transferred. (This is true on both 32-bit and 64-bit systems.) Limiting max block