From 6f3a673aba205b1dced06331c02f030b8bb4963d Mon Sep 17 00:00:00 2001 From: teknium1 Date: Mon, 9 Mar 2026 23:40:20 -0700 Subject: [PATCH] fix: restore success-path server_sock.close() before rpc_thread.join() PR #568 moved the close entirely to the finally block, but the success-path close is needed to break the RPC thread out of accept() immediately. Without it, rpc_thread.join(3) may block for up to 3 seconds if the child process never connected. The finally-block close remains as a safety net for the exception/error path (the actual fd leak fix). --- tools/code_execution_tool.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/code_execution_tool.py b/tools/code_execution_tool.py index 8c103e2f1..63ac7dec2 100644 --- a/tools/code_execution_tool.py +++ b/tools/code_execution_tool.py @@ -511,6 +511,7 @@ def execute_code( duration = round(time.monotonic() - exec_start, 2) # Wait for RPC thread to finish + server_sock.close() # break accept() so thread exits promptly rpc_thread.join(timeout=3) # Build response