MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_threads_reaped

Method test_threads_reaped

Lib/test/test_socketserver.py:489–503  ·  view source on GitHub ↗

In #37193, users reported a memory leak due to the saving of every request thread. Ensure that not all threads are kept forever.

(self)

Source from the content-addressed store, hash-verified

487 server.server_close()
488
489 def test_threads_reaped(self):
490 """
491 In #37193, users reported a memory leak
492 due to the saving of every request thread. Ensure that
493 not all threads are kept forever.
494 """
495 class MyServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
496 pass
497
498 server = MyServer((HOST, 0), socketserver.StreamRequestHandler)
499 for n in range(10):
500 with socket.create_connection(server.server_address):
501 server.handle_request()
502 self.assertLess(len(server._threads), 10)
503 server.server_close()
504
505
506if __name__ == "__main__":

Callers

nothing calls this directly

Calls 6

lenFunction · 0.85
MyServerClass · 0.70
create_connectionMethod · 0.45
handle_requestMethod · 0.45
assertLessMethod · 0.45
server_closeMethod · 0.45

Tested by

no test coverage detected