Intermittent bug with asyncio and MS Edge

Barry Scott barry at barrys-emacs.org
Sun Mar 22 05:00:41 EDT 2020



> On 22 Mar 2020, at 07:56, Frank Millman <frank at chagford.com> wrote:
> 
> On 2020-03-21 8:04 PM, Barry Scott wrote:
>>> On 21 Mar 2020, at 13:43, Frank Millman <frank at chagford.com> wrote:
>>> 
>>> Hi all
>>> 
>>> I have a strange intermittent bug.
>>> 
>>> The role-players -
>>>    asyncio on Python 3.8 running on Windows 10
>>>    Microsoft Edge running as a browser on the same machine
>>> 
>>> The bug does not occur with Python 3.7.
>>> It does not occur with Chrome or Firefox.
>>> It does not occur when MS Edge connects to another host on the network, running the same Python program (Python 3.8 on Fedora 31).
>>> 
>>> The symptoms -
>>>    On receiving a connection, I send an HTML page to the browser,
>>>        which has 20 lines like this -
>>> 
>>>    <script type="text/javascript" src="src/main.js"></script>
>>>    <script type="text/javascript" src="src/on_load.js"></script>
>>>    ...
>>> 
>>> Intermittently, one or other of the script files is not received by MS Edge.
>>> 
> [...]
>>> >> I don't know whether the problem lies with Python or MS Edge, but as 
> it does not happen with Python 3.7, I am suspecting that something changed in 3.8 which does not match MS Edge's expectations.
>> I'd look at the network traffic with wireshark to see if there is anything different between edge and the other browsers.
> 
> You are leading me into deep waters here :-)  I have never used Wireshark before. I have now downloaded it and am running it - it generates a *lot* of data, most of which I do not understand yet!

You can tell wireshark to only capture on one interface and to only capture packets for port 80.
(Captureing HTTPS means you cannot decode the packets without going deeper I recall)

Then you can tell wireshark to decode the captured data for http to drop a lot of the lower level details.


> 
> One thing immediately stands out. When I run it with MS Edge and Python3.8, it shows a lot of lines highlighted in red, with the symbols [RST,ACK]. They do not appear when running Chrome, and they do not appear when running Python3.7.

As Chris said that should not happen.

> 
> I have another data point. I tried putting an asyncio.sleep() after sending each file. A value of 0.01 made no difference, but a value of 0.1 makes the problem go away.

What is the async wait to wait for the transmit buffers to drain?

> 
> I will keep digging, but I thought I would post this information now in case it helps with diagnosis.
> 
> Frank
> -- 
> https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>
Barry


More information about the Python-list mailing list