From 440587b261c41d306aa06d04a9c2bccce7ebc610 Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Wed, 1 Jul 2020 15:03:00 -0700 Subject: [PATCH] Fix #314: Occasional missing response to "configurationDone" Don't treat missing response as error, but gracefully finalize the debug session instead. --- src/debugpy/adapter/clients.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/debugpy/adapter/clients.py b/src/debugpy/adapter/clients.py index d96ed05b..2db1aa4e 100644 --- a/src/debugpy/adapter/clients.py +++ b/src/debugpy/adapter/clients.py @@ -211,6 +211,16 @@ class Client(components.Component): # to conform to the DAP spec, we'll need to defer waiting for response. try: self.server.channel.request(request.command, arguments) + except messaging.NoMoreMessages: + # Server closed connection before we could receive the response to + # "configurationDone" - this can happen when debuggee exits shortly + # after starting. It's not an error, but we can't do anything useful + # here at this point, either, so just bail out. + request.respond({}) + self.session.finalize( + fmt('{0} disconnected before responding to "configurationDone"', self.server) + ) + return except messaging.MessageHandlingError as exc: exc.propagate(request)