emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-element persist logic hangs when quitting emacs
@ 2022-01-26 21:20 Kaushal Modi
  2022-01-29  9:42 ` Ihor Radchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Kaushal Modi @ 2022-01-26 21:20 UTC (permalink / raw)
  To: emacs-org list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: org-element persist logic hangs when quitting emacs
  2022-01-26 21:20 org-element persist logic hangs when quitting emacs Kaushal Modi
@ 2022-01-29  9:42 ` Ihor Radchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2022-01-29  9:42 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Kaushal Modi <kaushal.modi@gmail.com> writes:

> 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.

Thanks for the report!

Could you try running M-: (org-element-at-point (point-max)) in your
journal.org and let me know if it takes a very long time?

Best,
Ihor


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-29  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-26 21:20 org-element persist logic hangs when quitting emacs Kaushal Modi
2022-01-29  9:42 ` Ihor Radchenko

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).