From 7454f89d2583115078fd155508b2ddc19a2a50f6 Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Mon, 17 Feb 2020 20:48:25 -0800 Subject: [PATCH] Fix sporadic EBADF from accept() --- src/debugpy/common/sockets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debugpy/common/sockets.py b/src/debugpy/common/sockets.py index 335cf942..169f42d4 100644 --- a/src/debugpy/common/sockets.py +++ b/src/debugpy/common/sockets.py @@ -78,7 +78,7 @@ def serve(name, handler, host, port=0, backlog=socket.SOMAXCONN, timeout=None): while True: try: sock, (other_host, other_port) = listener.accept() - except OSError: + except (OSError, socket.error): # Listener socket has been closed. break