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

debugpy will not terminate politely. #8

Closed
milanglacier opened this issue Oct 21, 2023 · 2 comments
Closed

debugpy will not terminate politely. #8

milanglacier opened this issue Oct 21, 2023 · 2 comments

Comments

@milanglacier
Copy link
Contributor

milanglacier commented Oct 21, 2023

There is a docker image which can reproduce the problem:

https://hub.docker.com/repository/docker/northyear/dape-repro/general

steps to reproduce:

  1. launch that docker image docker run -it —rm dape-repro
  2. cd ~/.emacs.d
  3. emacs -nw hello.py
  4. add a break point at the second line: sum = 0
  5. C-x C-a d debugpy RET, that is, execute dape
  6. C-x C-a c, that is, execute dape-continue.
  7. C-x C-cto quit emacs.
  8. ps -a, see that debugpy process does not quit and keep consuming high CPU usage (100% in my computer)

This is the config file used for the docker image:

(require 'package)
(setq package-user-dir "~/.emacs.d/emacs-package-dir")

(setq debug-on-error t)

(setq package-list '())
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(dolist (package package-list)
  (unless (package-installed-p package)
    (package-install package)))

(setq warning-minimum-level :error)

(menu-bar-mode -1)
;;(tool-bar-mode -1)
;;(scroll-bar-mode -1)
(xterm-mouse-mode 1)

(setq scroll-step 1)
(setq scroll-conservatively 10000)
(setq auto-window-vscroll nil)

(add-to-list 'load-path "~/.emacs.d/emacs-package-dir/dape")

(defun plistp (object)
  "Non-nil if and only if OBJECT is a valid plist."
  (let ((len (proper-list-p object)))
    (and len (zerop (% len 2)))))

(require 'dape)

(add-to-list 'dape-configs
                 '(debugpy
                   modes (python-ts-mode python-mode)
                   command "~/.emacs.d/venv/bin/python3"
                   command-args ("-m" "debugpy.adapter")
                   :type "executable"
                   :request "launch"
                   :cwd dape-cwd-fn
                   :program dape-find-file-buffer-default))
@milanglacier milanglacier changed the title debugpy will not quit politely. debugpy will not terminate politely. Oct 21, 2023
svaante added a commit that referenced this issue Oct 21, 2023
Before emacs exits we should handle the debug process, otherwise we
might leave some debuggee behind.
@svaante
Copy link
Owner

svaante commented Oct 21, 2023

Nice find 👍 Please test again against master.

@milanglacier
Copy link
Contributor Author

The latest patch works for me!

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

No branches or pull requests

2 participants