Hello,

Lately (at least as of last 3 days), I have seen that when I try to
quit emacs, it gets stuck on one of my Org files; it's a personal
journal.org that I frequently update using org-capture. So that file
is usually open in one of the buffers.

Today I did M-x toggle-debug-on-quit and tried to quit emacs. When it
got stuck, I hit C-g and I saw this backtrace:

=====
Debugger entered--Lisp error: (quit)
  org-get-limited-outline-regexp()
  org-element--current-element(567757 element nil nil)
  org-element--parse-to(567811)
  org-element-at-point(567811)
  org-element--cache-persist-before-write(org-element--cache #<buffer
journal.org>)
  run-hook-with-args-until-success(org-element--cache-persist-before-write
org-element--cache #<buffer journal.org>)
  #f(compiled-function (v) #<bytecode -0x1255da2e8df90b5a>)(org-element--cache)
  #f(compiled-function (elt) #<bytecode -0x5113f32f09391ba>)(org-element--cache)
  mapc(#f(compiled-function (elt) #<bytecode -0x5113f32f09391ba>)
(org-element--headline-cache org-element--cache))
  seq-do(#f(compiled-function (elt) #<bytecode -0x5113f32f09391ba>)
(org-element--headline-cache org-element--cache))
  seq-find(#f(compiled-function (v) #<bytecode -0x1255da2e8df90b5a>)
(org-element--headline-cache org-element--cache))
  org-persist-write((org-element--headline-cache org-element--cache)
#<buffer journal.org>)
  org-persist-write-all()
  #f(compiled-function (fun) #<bytecode
-0xad4b8ed49b65042>)(org-persist-write-all)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode
-0xad4b8ed49b65042>) org-persist-write-all)
  run-hook-query-error-with-timeout(kill-emacs-hook)
  kill-emacs()
  save-buffers-kill-emacs()
  (if (daemonp) (save-buffers-kill-emacs) (save-buffers-kill-terminal))
  modi/quit-emacs(nil)
  funcall-interactively(modi/quit-emacs nil)
  call-interactively(modi/quit-emacs nil nil)
  command-execute(modi/quit-emacs)
=====


I had also enabled the profiler. The profiler report showed this:

=====
       14247  92% - command-execute
       14247  92%  - call-interactively
       14247  92%   - funcall-interactively
       13973  91%    - modi/quit-emacs
       13973  91%     - if
       13939  90%      - save-buffers-kill-emacs
       13834  90%       - kill-emacs
       13834  90%        - run-hook-query-error-with-timeout
       13834  90%         - run-hook-wrapped
       13834  90%          - #<compiled -0xad4b8ed49b65042>
       13724  89%           - org-persist-write-all
       13715  89%            - org-persist-write
       13698  89%             - seq-find
       13698  89%              - seq-do
       13698  89%               - mapc
       13698  89%                - #<compiled -0x5113f32f09391ba>
       13698  89%                 - #<compiled -0x1255da2e8df90b5a>
       13698  89%                  - run-hook-with-args-until-success
       13698  89%                   - org-element--cache-persist-before-write
       13698  89%                    - org-element-at-point
       13244  86%                     - org-element--parse-to
        6568  42%                      + org-element--current-element
        2649  17%                      + org-element--cache-put
=====


I was able to quit emacs once I disabled the cache feature by setting
org-element-use-cache to nil.

---

- Org mode version 9.5 (release_9.5-428-g26dece)
- Emacs version: GNU Emacs 28.0.91 (build 7, x86_64-pc-linux-gnu, GTK+
Version 3.22.30, cairo version 1.15.12) of 2022-01-25, built using
commit 7eca80b20444f7bd7bcb6a66a9054e029f0e7013.


--
Kaushal Modi

Reply via email to