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 calls drain(), but the first function is already waiting on 
drain(): bug occurs since the code doesn't support having two coroutines 
waiting on drain() in parallel

Notes:

* the minimum is to document that drain() must not be called twice in parallel. 
Right now, nothing is said about that:
https://docs.python.org/dev/library/asyncio-stream.html#asyncio.StreamWriter.drain

* we can probably design something to allow to have multiple coroutines waiting 
on the same event

--

Metathink told me that he got the bug on a much more complex code using 
websockets. Thank you Metathink for isolating the bug to a few lines of Python 
code with simpler asyncio functions!

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29930>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to