This PR fixes test_context.test_create_ssl_server_manual_connection_lost flakiness that became very apparent when using PYTHONASYNCIODEBUG=1 after Python 3.13.12 and 3.14.3. Previous versions are unaffected because they don't contain the patch introduced by python/cpython#141696 although it may still rarely flake on older versions.
After python/cpython#141696 loop.run_in_executor(..., ssl_sock.send) now often resolves without yielding to the event loop when PYTHONASYNCIODEBUG=1 is set. When no yielding happens the SSL incoming buffer never gets the sent data while _app_reading_paused was set to true.
Looking at the test and context when it was introduced in #348, I believe there was an implicit assumption that run_in_executor would yield in this test so that it would go through the expected internal path of epoll_pwait -> buffer_updated_impl before scheduling close flushing process and resume_reading setting _app_reading_paused to false.
Disclosure: This PR is made by human-only contribution without AI generated code.
Note this PR will remain in draft as it relies on #742 to show success of the CI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes test_context.test_create_ssl_server_manual_connection_lost flakiness that became very apparent when using PYTHONASYNCIODEBUG=1 after Python 3.13.12 and 3.14.3. Previous versions are unaffected because they don't contain the patch introduced by python/cpython#141696 although it may still rarely flake on older versions.
After python/cpython#141696 loop.run_in_executor(..., ssl_sock.send) now often resolves without yielding to the event loop when PYTHONASYNCIODEBUG=1 is set. When no yielding happens the SSL incoming buffer never gets the sent data while _app_reading_paused was set to true.
Looking at the test and context when it was introduced in #348, I believe there was an implicit assumption that run_in_executor would yield in this test so that it would go through the expected internal path of epoll_pwait -> buffer_updated_impl before scheduling close flushing process and resume_reading setting _app_reading_paused to false.
Disclosure: This PR is made by human-only contribution without AI generated code.
Note this PR will remain in draft as it relies on #742 to show success of the CI.