]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-110167: Fix test_socket deadlock in doCleanups() (#110416)
authorVictor Stinner <vstinner@python.org>
Thu, 5 Oct 2023 18:53:03 +0000 (20:53 +0200)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 18:53:03 +0000 (20:53 +0200)
commit318f5df27109ff8d2519edefa771920a0ec62b92
tree0c38e6feb997021ec49437962cc92835eac1bdd7
parent1f3af03f83fead5cd86d54e1b2f47fc5866e635c
gh-110167: Fix test_socket deadlock in doCleanups() (#110416)

Fix a deadlock in test_socket when server fails with a timeout but
the client is still running in its thread. Don't hold a lock to call
cleanup functions in doCleanups(). One of the cleanup function waits
until the client completes, whereas the client could deadlock if it
called addCleanup() in such situation.

doCleanups() is called when the server completed, but the client can
still be running in its thread especially if the server failed with a
timeout. Don't put a lock on doCleanups() to prevent deadlock between
addCleanup() called in the client and doCleanups() waiting for
self.done.wait of ThreadableTest._setUp().
Lib/test/test_socket.py
Misc/NEWS.d/next/Tests/2023-10-05-19-33-49.gh-issue-110167.mIdj3v.rst [new file with mode: 0644]