Skip to content

gh-158313: Clear the OpenSSL error queue when ssl raises OSError - #158333

Closed
lazerg wants to merge 1 commit into
python:mainfrom
lazerg:fix-issue-158313
Closed

lazerg wants to merge 1 commit into
python:mainfrom
lazerg:fix-issue-158313

Conversation

@lazerg

@lazerg lazerg commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

The two ERR_LIB_SYS branches in PySSL_SetError return early and skip the ERR_clear_error() call that every other path makes. The entry then stays on the thread's error queue, and SSL_get_error() picks it up on the next I/O call on any socket in that thread, so the same OSError is raised again and again. This clears the queue in both branches, like the e == 0 branch already does.

The test fails on main with BrokenPipeError from the second connection.

Fixes #158313

@lazerg

lazerg commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

@cmaloney, please have a look when you have time

@lazerg

lazerg commented Nov 15, 2026

Copy link
Copy Markdown
Contributor Author

Closing due to inactivity.

@lazerg lazerg closed this Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant