[issue29930] asyncio.StreamWriter.drain raises an AssertionError under heavy use

2017-03-28 Thread STINNER Victor
STINNER Victor added the comment: Proof-of-concept of patched drain() to support multiple waiters. I don't see any strong reason to not allow two coroutines to wait on drain() in parallel? I'm too lazy to write a full patch with unit tests, doc changed, etc. I started with a PoC to discuss

[issue29930] asyncio.StreamWriter.drain raises an AssertionError under heavy use

2017-03-28 Thread STINNER Victor
STINNER Victor added the comment: I understood that: * code fills the write buffer of the transport until writing is paused because of the high water mark * a function calls drain() which waits until the server reads until packets to reduce the size of the write buffer * a second function

[issue29930] asyncio.StreamWriter.drain raises an AssertionError under heavy use

2017-03-28 Thread STINNER Victor
STINNER Victor added the comment: The bug occurs when the transport pauses writing and the client code calls drain() multiple times in parallel. -- ___ Python tracker

[issue29930] asyncio.StreamWriter.drain raises an AssertionError under heavy use

2017-03-28 Thread STINNER Victor
STINNER Victor added the comment: Modified client and server to be able to reproduce the issue on a LAN. -- nosy: +haypo Added file: http://bugs.python.org/file46762/client.py ___ Python tracker

[issue29930] asyncio.StreamWriter.drain raises an AssertionError under heavy use

2017-03-28 Thread STINNER Victor
Changes by STINNER Victor : Added file: http://bugs.python.org/file46761/server.py ___ Python tracker ___

[issue29930] asyncio.StreamWriter.drain raises an AssertionError under heavy use

2017-03-28 Thread Metathink
New submission from Metathink: While trying to break some code in a project using asyncio, I found that under certain circumstances, asyncio.StreamWriter.drain raises an AssertionError. 1. There must be a lot of concurrent uses of "await writer.drain()" 2. The server on which we send data must