Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: getting stuck waiting for socket to connect (#4213)

etrotta883ca885cdcb
diff --git a/marimo/_server/utils.py b/marimo/_server/utils.py
index f92cb21e93..691c92d1d0 100644
--- a/marimo/_server/utils.py
+++ b/marimo/_server/utils.py
@@ -44,6 +44,7 @@ def find_free_port(port: int, attempts: int = 100) -> int:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
try:
+ sock.settimeout(0.1)
in_use = sock.connect_ex(("localhost", port)) == 0
if not in_use:
return port