Skip to content

fix(tests): explicit yield in test_create_ssl_server_manual_connection_lost#743

Draft
samypr100 wants to merge 2 commits intoMagicStack:masterfrom
samypr100:fix-yield
Draft

fix(tests): explicit yield in test_create_ssl_server_manual_connection_lost#743
samypr100 wants to merge 2 commits intoMagicStack:masterfrom
samypr100:fix-yield

Conversation

@samypr100
Copy link
Copy Markdown

@samypr100 samypr100 commented Apr 4, 2026

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant