diff --git a/artiq/protocols/logging.py b/artiq/protocols/logging.py index 693e58f7d..0c600e288 100644 --- a/artiq/protocols/logging.py +++ b/artiq/protocols/logging.py @@ -125,6 +125,9 @@ class Server(AsyncioServer): return source, remainder = linesplit parser.line_input(remainder) + except (ConnectionResetError, ConnectionAbortedError, BrokenPipeError): + # May happens on Windows when client disconnects + pass finally: writer.close() diff --git a/artiq/protocols/pc_rpc.py b/artiq/protocols/pc_rpc.py index 6d9feadb5..d1de343a9 100644 --- a/artiq/protocols/pc_rpc.py +++ b/artiq/protocols/pc_rpc.py @@ -502,6 +502,9 @@ class Server(_AsyncioServer): "message": traceback.format_exc()} line = pyon.encode(obj) + "\n" writer.write(line.encode()) + except (ConnectionResetError, ConnectionAbortedError, BrokenPipeError): + # May happens on Windows when client disconnects + pass finally: writer.close()