添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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.

I have been getting an intermittent errors when using asyncio with SSL. The error always occurs in the _process_write_backlog method in asyncio's sslproto.py file. I have looked at lots of possibilities as to what the cause is and found that for some reason when in _process_write_backlog's loop the deque seems to be empty, I added some quick terrible hacky code to confirm it fixed the issue and checking at each point it is used wether it is empty fixes the issue, I am unusure as to what causes it to become empty but still run through the loop. The most frequent time it happens is after we have a successful message the client sends a request to join a data stream this request mostly causes the error but sometimes it happens while the client is receiving data. I am currently using python 3.7.1 but have also tested my code on 3.7.3 with the same result. 
NOTE: I am currently working on a minimal sample to show the issue easier.
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f267462e780>
transport: <_SelectorSocketTransport fd=38 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 689, in _process_write_backlog
    del self._write_backlog[0]
IndexError: deque index out of range
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7f45f802ec88>
transport: <_SelectorSocketTransport fd=29 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
    File "/usr/local/lib/python3.7/asyncio/sslproto.py", line 664, in _process_write_backlog
    data, offset = self._write_backlog[0]
IndexError: deque index out of range
I can fully confirm the issue is due to flow control or lack of in my code the system runs out of resources and this is when it errors, I have implemented flow control in my protocol and it now works without errors. One thing I did find is that the documentation on flow control was lacking but luckily I found this post which makes implementation clearer https://medium.com/@pgjones/an-asyncio-socket-tutorial-5e6f3308b8b0
I am not sure if you would still classify this as a bug the error could be clearer but it could be expected behaviour when you run out of resources, I think this can now be closed I am just unsure of the etiquette as to who closes it and what resolution should be selected.
2022-04-11 14:59:16adminsetgithub: 81407 2019-12-11 09:13:16ben.brownsetstatus: open -> closed
stage: resolved 2019-07-22 10:53:53ben.brownsetmessages: + msg348294 2019-07-19 11:49:09ben.brownsetmessages: + msg348167 2019-07-14 11:12:59maayanksetmessages: + msg347906 2019-07-09 16:15:31ben.brownsetmessages: + msg347564 2019-06-30 14:14:14maayanksetnosy: + maayank
messages: + msg346930
2019-06-24 10:38:40ben.brownsetmessages: + msg346365 2019-06-12 11:08:58asvetlovsetmessages: + msg345317 2019-06-12 11:05:45ben.brownsetmessages: + msg345316 2019-06-11 15:38:34ben.brownsetmessages: + msg345241 2019-06-11 11:22:52ben.brownsetmessages: + msg345223 2019-06-11 10:09:56christian.heimessetmessages: + msg345215 2019-06-11 10:08:56ben.brownsetmessages: + msg345214 2019-06-11 10:00:13asvetlovsetmessages: + msg345213 2019-06-11 09:43:20ben.brownsetmessages: + msg345212 2019-06-11 09:41:20asvetlovsetmessages: + msg345211 2019-06-11 08:47:56christian.heimessetnosy: + asvetlov , yselivanov
messages: + msg345202
components: + asyncio
2019-06-11 08:44:59ben.browncreate