mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Revert "bpo-37193: remove thread objects which finished process its request (GH-13893)" (GH-23107)
This reverts commit c415590212
.
This commit is contained in:
parent
4b9aad4999
commit
aca67da4fe
3 changed files with 13 additions and 86 deletions
|
@ -277,13 +277,6 @@ class SocketServerTest(unittest.TestCase):
|
|||
t.join()
|
||||
s.server_close()
|
||||
|
||||
def test_close_immediately(self):
|
||||
class MyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
||||
pass
|
||||
|
||||
server = MyServer((HOST, 0), lambda: None)
|
||||
server.server_close()
|
||||
|
||||
def test_tcpserver_bind_leak(self):
|
||||
# Issue #22435: the server socket wouldn't be closed if bind()/listen()
|
||||
# failed.
|
||||
|
@ -498,23 +491,6 @@ class MiscTestCase(unittest.TestCase):
|
|||
self.assertEqual(server.shutdown_called, 1)
|
||||
server.server_close()
|
||||
|
||||
def test_threads_reaped(self):
|
||||
"""
|
||||
In #37193, users reported a memory leak
|
||||
due to the saving of every request thread. Ensure that the
|
||||
threads are cleaned up after the requests complete.
|
||||
"""
|
||||
class MyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
|
||||
pass
|
||||
|
||||
server = MyServer((HOST, 0), socketserver.StreamRequestHandler)
|
||||
for n in range(10):
|
||||
with socket.create_connection(server.server_address):
|
||||
server.handle_request()
|
||||
[thread.join() for thread in server._threads]
|
||||
self.assertEqual(len(server._threads), 0)
|
||||
server.server_close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue