From 4ac69aacda17e722cee8fccf561aab5c8a425893 Mon Sep 17 00:00:00 2001 From: YuriCat Date: Thu, 12 Oct 2023 05:11:50 +0900 Subject: [PATCH 1/2] fix: disconnect after socket.timeout --- handyrl/connection.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/handyrl/connection.py b/handyrl/connection.py index 8b01d555..51e6271e 100755 --- a/handyrl/connection.py +++ b/handyrl/connection.py @@ -201,6 +201,8 @@ def _send_thread(self): conn, send_data = self.output_queue.get() try: conn.send(send_data) + except TimeoutError: + self.disconnect(conn) except ConnectionResetError: self.disconnect(conn) except BrokenPipeError: @@ -212,6 +214,9 @@ def _recv_thread(self): for conn in conns: try: recv_data = conn.recv() + except TimeoutError: + self.disconnect(conn) + continue except ConnectionResetError: self.disconnect(conn) continue From 7a7b933f215a675564c5ca9523ff685e4aa6785c Mon Sep 17 00:00:00 2001 From: YuriCat Date: Fri, 1 Mar 2024 22:22:55 +0900 Subject: [PATCH 2/2] fix: integer value for randrange() --- handyrl/evaluation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handyrl/evaluation.py b/handyrl/evaluation.py index 45c4d225..37e28f37 100755 --- a/handyrl/evaluation.py +++ b/handyrl/evaluation.py @@ -396,7 +396,7 @@ def resolve_agent(model_path): print('%d process, %d games' % (num_process, num_games)) - seed = random.randrange(1e8) + seed = random.randrange(int(1e8)) print('seed = %d' % seed) opponent = model_paths[1] if len(model_paths) > 1 else 'random' @@ -416,7 +416,7 @@ def eval_server_main(args, argv): print('%d process, %d games' % (num_process, num_games)) - seed = random.randrange(1e8) + seed = random.randrange(int(1e8)) print('seed = %d' % seed) evaluate_mp(env, [None] * len(env.players()), None, env_args, {'default': {}}, num_process, num_games, seed)