Skip to content

Conversation

@AleksMat
Copy link
Contributor

@AleksMat AleksMat commented Mar 6, 2025

Until now, the process of closing the connection between Debugpy and a client (e.g. VSCode) would be the following:

  1. a client sends a disconnect request,
  2. Debugpy sends back a disconnect response acknowledging the disconnect,
  3. the client sends an empty line,
  4. Debugpy waits for an empty line and only then closes connection (link to code).

The problem is that, unlike VSCode, not all clients send this empty line. Because of that, when a user shuts down the debugger, the Debugpy's process won't die. It keeps waiting for that empty line to close the connection and at the same time occupying the communication port with the client. I believe this is the reason for the bug reported in #1783.

AFAIK, sending an empty line is not a part of the DAP protocol. Therefore, Debugpy shouldn't rely on it and should instead proactively close connection once it sends a disconnect response to the client.

This PR aims to fix this.

@AleksMat AleksMat requested a review from a team as a code owner March 6, 2025 16:01
@AleksMat
Copy link
Contributor Author

AleksMat commented Mar 6, 2025

Note: the current implementation of the fix might be a bit naive but I'm happy to iterate on the solution with some guidance.

@rchiodo
Copy link
Contributor

rchiodo commented Mar 7, 2025

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rchiodo
Copy link
Contributor

rchiodo commented Mar 7, 2025

Thanks for the submission, Win 3.13 failures aren't related so just going to merge.

@rchiodo rchiodo merged commit f054965 into microsoft:main Mar 7, 2025
22 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants