This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skorpeo
Recipients asvetlov, skorpeo, yselivanov
Date 2018-05-27.22:34:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527460481.84.0.682650639539.issue33662@psf.upfronthosting.co.za>
In-reply-to
Content
I humbly submit what I think may be a bug in the asyncio.StreamReader.read() function.  When n=-1 is supplied and the data is less than self._limit the read function creates a future and never wakes it up.  I believe the culprit is https://github.com/python/cpython/blob/9d3627e311211a1b4abcda29c36fe4afe2c46532/Lib/asyncio/streams.py#L632.  To fix the issue a condition is added to break out of the loop if the data read is less than the limit.  I can only attach one file so I am providing the fix here for asyncio streams.py:  

blocks.append(block)           # existing
if len(block) < self._limit:   # new
    break                      # new

I have also attached a test file that shows the blocking behavior which is alleviated with the above fix.  Finally, I am not sure how to handle a situation where the data is exactly equal to the limit and no subsequent data is sent.
History
Date User Action Args
2018-05-27 22:34:41skorpeosetrecipients: + skorpeo, asvetlov, yselivanov
2018-05-27 22:34:41skorpeosetmessageid: <1527460481.84.0.682650639539.issue33662@psf.upfronthosting.co.za>
2018-05-27 22:34:41skorpeolinkissue33662 messages
2018-05-27 22:34:41skorpeocreate