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.

Title: data_received called on protocol after call to pause_reading on ssl transport
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.11
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, chrisb2, kumaraditya, yselivanov
Priority: normal Keywords:

Created on 2021-09-10 04:23 by chrisb2, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg401553 - (view) Author: Christopher Brichford (chrisb2) Date: 2021-09-10 04:23
An SSL connection created with loop.create_connection may have data_received called on its protocol after pause_reading has been called on the transport.

If an application has a protocol whose data_received method calls pause_reading on the transport then there is a chance that the data_received method will be called again before the application calls resume_reading on the transport.

That existing implementation of pause_reading at:

calls pause_reading on the underlying socket transport, which is correct.  However, there is a loop in the SSLProtocol's data_received method:

If the loop referenced above has more than one iteration then there is a chance that the application protocol's data_received method could call pause_reading on the transport.  If that happens on any iteration of the loop other than the last iteration, then the SSLProtocol's data_received method will call the application protocol's data_received method when it should not.

Stealing uvloop's asyncio ssl implementation would resolve this bug:
msg414106 - (view) Author: Kumar Aditya (kumaraditya) * (Python triager) Date: 2022-02-26 14:17
Since is fixed, this can be closed now.
Date User Action Args
2022-04-11 14:59:49adminsetgithub: 89322
2022-02-26 14:47:06asvetlovsetstatus: open -> closed
stage: resolved
resolution: fixed
versions: + Python 3.11, - Python 3.10
2022-02-26 14:17:03kumaradityasetnosy: + kumaraditya
messages: + msg414106
2021-09-10 04:23:52chrisb2create