[issue36981] asyncio transport.write() memory out

2019-05-22 Thread SilentGhost
Change by SilentGhost : -- resolution: fixed -> not a bug stage: -> resolved status: -> closed ___ Python tracker ___ ___

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread viocal
viocal added the comment: I have fixed it modified selector_events.py def write(self, data): if not isinstance(data, (bytes, bytearray, memoryview)): raise TypeError(f'data argument must be a bytes-like object, ' f'not

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread viocal
viocal added the comment: I have fixed it modified selector_events.py def write(self, data): if not isinstance(data, (bytes, bytearray, memoryview)): raise TypeError(f'data argument must be a bytes-like object, ' f'not

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread viocal
viocal added the comment: thanks again the environment: filedata1<512M filedata2>512M filedata3>1G this computer-peer computer server(with asyncio)--clien(socket without asyncio) memory<512M---memory>512M read filedata1 <- success read filedata2 <-

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread Andrew Svetlov
Andrew Svetlov added the comment: Please re-read my previous comment. If you use asyncio incorrectly -- yes, you can run out of memory. The proper usage of pause_readind()/resume_reading() resolves the issue. -- ___ Python tracker

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread viocal
viocal added the comment: for example the system free memory size is 512m and filedata size is 500m will transport Success but filedata than 512m will be failed -- resolution: not a bug -> ___ Python tracker

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread Andrew Svetlov
Andrew Svetlov added the comment: No. pause_writing/resume_writing are protocol callbacks called by transport. User code should respond to these callbacks by stopping sending data to transport (transport.write()). The logic is a little complicated but it is ok for very low-level asyncio API.

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread viocal
viocal added the comment: thanks you but I think protocol.resume_writing() / protocol.pause_writing() is auto called by Protocol because set transport.set_write_buffer_limits(high=65536*2, low=16384*2) #default (high=65536, low=16384) -- ___

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread Andrew Svetlov
Andrew Svetlov added the comment: No. It doesn't work this way. pause_writing is a protocol callback called from transport when the internal buffer is full. In reaction to this callback the producer should stop calling transport.write() and resume writing after getting `resume_writing()`.

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread viocal
viocal added the comment: for buf in filedata: asc.resume_writing() asc.transport.write(buf) asc.pause_writing() -- ___ Python tracker ___

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread Andrew Svetlov
Andrew Svetlov added the comment: I'm sorry but I cannot tell why you are using `pause_writing` incorrectly without looking on the code. -- ___ Python tracker ___

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread viocal
viocal added the comment: I use rotocol.pause_writing() / Protocol.resume_writing() but results is no change(memory out Or killed by OS) -- ___ Python tracker ___

[issue36981] asyncio transport.write() memory out

2019-05-21 Thread Andrew Svetlov
Andrew Svetlov added the comment: The correct approach is using Protocol.pause_writing() / Protocol.resume_writing() callbacks. No trivial, though. See `StreamWriter.drain()` for example of implementation. -- ___ Python tracker

[issue36981] asyncio transport.write() memory out

2019-05-20 Thread viocal
New submission from viocal : in asyncio when filedata than free memory(hardware) will be memory out Or killed by OS for buf in filedata: transport.write(buf) #to client I try it todo: abort transporting to protect application be killed by OS modified selector_events.py def