Message317810
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. |
|
Date |
User |
Action |
Args |
2018-05-27 22:34:41 | skorpeo | set | recipients:
+ skorpeo, asvetlov, yselivanov |
2018-05-27 22:34:41 | skorpeo | set | messageid: <1527460481.84.0.682650639539.issue33662@psf.upfronthosting.co.za> |
2018-05-27 22:34:41 | skorpeo | link | issue33662 messages |
2018-05-27 22:34:41 | skorpeo | create | |
|