emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: org-element persist logic hangs when quitting emacs
Date: Wed, 26 Jan 2022 16:20:21 -0500	[thread overview]
Message-ID: <CAFyQvY0dUnFpDXFmd_hz_nNQ=tvP2wumUPpFo84H0BhELQN5-g@mail.gmail.com> (raw)

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	other threads:[~2022-01-26 21:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26 21:20 Kaushal Modi [this message]
2022-01-29  9:42 ` org-element persist logic hangs when quitting emacs Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY0dUnFpDXFmd_hz_nNQ=tvP2wumUPpFo84H0BhELQN5-g@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).