]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.11] gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHan...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 14 May 2025 18:31:04 +0000 (20:31 +0200)
committerGitHub <noreply@github.com>
Wed, 14 May 2025 18:31:04 +0000 (20:31 +0200)
commit461ca2cbfb7c92b80e14463854525f162716b8ff
tree5158b8c57619bc507e84e4732474d87c6d1b1b38
parentab4746261870bcdbb6e7c5a5b307465fbe517790
[3.11] gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503) (GH-126572) (GH-133148)

gh-126500: test_ssl: Don't stop ThreadedEchoServer on OSError in ConnectionHandler; rely on __exit__ (GH-126503)

If `read()` in the ConnectionHandler thread raises `OSError` (except `ConnectionError`),
the ConnectionHandler shuts down the entire ThreadedEchoServer,
preventing further connections.
It also does that for `EPROTOTYPE` in `wrap_conn`.

As far as I can see, this is done to avoid the server thread getting stuck,
forgotten, in its accept loop. However, since 2011 (5b95eb90a7167285b6544b50865227c584943c9a)
the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.
(I'm not sure if we *always* used `with` since that commit, but currently we do.)

Make sure that the context manager *is* used, and remove the `server.stop()`
calls from ConnectionHandler.

(cherry picked from commit c9cda1608edf7664c10f4f467e24591062c2fe62)
(cherry picked from commit aee80cd5e7c6be90c69b9aa9c09faa19b91cdccd)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Lib/test/test_ssl.py