From 79707c93957f47cab085caee139a991655f860d3 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 8 Aug 2026 05:31:29 +0000 Subject: [PATCH] fix: wait for port to free after docker stop in debug mode --- sources/python/main.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sources/python/main.py b/sources/python/main.py index 722882f..7d9f1bc 100644 --- a/sources/python/main.py +++ b/sources/python/main.py @@ -407,6 +407,18 @@ def start_debug(): # Stop container, start tap print(f"\nStopping wallarm-{n['name']}...") run(f"docker stop wallarm-{n['name']} 2>/dev/null", timeout=10) + run(f"docker rm -f wallarm-{n['name']} 2>/dev/null", timeout=5) + # Wait for port to free + import time + for _ in range(10): + r = run(f"ss -tlnp | grep ':{port}' 2>/dev/null") + if not r.stdout.strip(): + break + time.sleep(1) + else: + print(f"Port {port} still in use — killing...") + run(f"fuser -k {port}/tcp 2>/dev/null", timeout=5) + time.sleep(2) print(f"Tap proxy :{port} → {backend}") print(f"Log: {logdir}/tap-*.log") print("Press Ctrl+C to stop — container will restart automatically.\n")