Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration option to issue a SIGTERM when the Stop button is clicked in debugger #316

Open
DeflateAwning opened this issue Apr 15, 2024 · 3 comments
Assignees
Labels
feature-request Request for new features or functionality needs community feedback

Comments

@DeflateAwning
Copy link

I want the ability to use the "Stop" button in the Python debugger in VS Code to send a SIGTERM (and/or maybe a SIGINT) to the running process, instead of just sending it SIGKILL (as it currently does).

This is the "Stop" button I'm talking about:
image

Proposed Solution

I'm thinking that a new option like this in the launch.json config file could be a good way to introduce this change without being a breaking change for the way everyone is used to the "stop" button working.

{
  "configurations": [
    {
      "name": "Python Debugger: Current File (Integrated Terminal)",
      "type": "debugpy",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "stop_action": "SIGKILL", // this would be a new enum-like config option, with values of "SIGKILL", "SIGINT", "SIGTERM", maybe others
    },
  ]
}

Possible additional ideas, more context

  • The minimum viable solution is described above.

  • SIGKILL (the current behavior) and SIGTERM are the two behaviors I'm personally chasing. SIGINT is another one that would be good to have as an option though.

  • As an extended implementation, the stop_action field could support a process like: send SIGTERM, wait 15 seconds, send SIGKILL.

  • This feature request stems from wanting to be able to test and debug the AWS Batch end-of-job behavior:

Under the hood, the Amazon ECS StopTask API call is used, which sends a SIGTERM value to the running container task. If after 30 seconds the container is still running, a SIGKILL signal is sent to forcibly stop the container. If the container handles the SIGTERM value gracefully and exits within 30 seconds from receiving it, no SIGKILL value is sent.

Related Previous Issues and Discussions

@DeflateAwning DeflateAwning added the feature-request Request for new features or functionality label Apr 15, 2024
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Apr 15, 2024
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Apr 16, 2024
@paulacamargo25 paulacamargo25 added needs community feedback and removed triage-needed Needs assignment to the proper sub-team labels May 31, 2024
@paulacamargo25
Copy link
Contributor

Thanks for the feature request! We are going to give the community 60 days to provide 7 👍 upvotes on the opening comment to gauge general interest in this idea. If there's enough upvotes then we will consider this feature request in our future planning. If there's unfortunately not enough upvotes then we will close this issue.

@cdelacruzpinto
Copy link

cdelacruzpinto commented Jun 22, 2024

Any intention to retake this? would be super useful to debug actions running on flask/fastapi app shutdown (i.e: closing db, connections, redis, etc)

@mes21
Copy link

mes21 commented Nov 19, 2024

Hi just wanted to add some support for the proposal, same use case as @cdelacruzpinto on my end.
Glad to see its on the list of things to come :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality needs community feedback
Projects
None yet
Development

No branches or pull requests

5 participants