diff --git a/tools/btconsole.py b/tools/btconsole.py index bdeb29c..55cc238 100644 --- a/tools/btconsole.py +++ b/tools/btconsole.py @@ -122,7 +122,7 @@ def serve_pod(hostport, egg_bytes): try: data = s.recv(4096) if not data: - print(f"[{name}] pod closed the console socket") + print(f"[{name}] pod closed the console socket", flush=True) return # Expect the AcknowledgeEggFile (and possibly other console traffic). if len(data) >= 24: @@ -134,6 +134,14 @@ def serve_pod(hostport, egg_bytes): print(f"[{name}] pod->console {len(data)} bytes") except socket.timeout: continue + except OSError as e: + # Previously UNHANDLED: a reset/abort here killed the thread silently + # (buffered stdout lost) and the console process exited -- leaving the + # pods holding dead console sockets. Log it and keep the thread alive + # (idle) so the process + diagnosis survive. + print(f"[{name}] console socket error: {e!r} -- idling", flush=True) + while True: + time.sleep(60) def main():