* [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] @ 2024-12-20 21:30 Paul Stansell 2024-12-23 17:16 ` Ihor Radchenko 0 siblings, 1 reply; 6+ messages in thread From: Paul Stansell @ 2024-12-20 21:30 UTC (permalink / raw) To: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 8185 bytes --] Hello, Occasionally, when I start emacs from the command line, I get this bug, but it's intermittent, so I have ignored it until now. All I can report is that I opened an org file named scratch.org and received the following error message: Warning (org-element): org-element--cache: Org parser error in scratch.org::8756. Resetting. The error was: (error "Invalid search bound (wrong side of point)") Backtrace: nil Please report this to Org mode mailing list (M-x org-submit-bug-report). Then I closed the buggy emacs window and tried again and it was fine. Paul ------------------------------------------------------------------------ Emacs : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2024-09-17, modified by Debian Package: Org mode version 9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/) current state: ============== (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-link-shell-confirm-function 'yes-or-no-p org-sort-function 'string-collate-lessp org-metadown-hook '(org-babel-pop-to-session-maybe) org-persist-before-write-hook '(org-element--cache-persist-before-write) org-startup-folded t org-id-link-to-org-use-id t org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-fold-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-clock-persist 'history org-archive-hook '(org-attach-archive-delete-maybe) org-persist-before-read-hook '(org-element--cache-persist-before-read) org-confirm-elisp-link-function 'yes-or-no-p org-clock-history-length 28 org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-persist-after-read-hook '(org-element--cache-persist-after-read) org-bibtex-headline-format-function 'org-bibtex-headline-format-default org-adapt-indentation t org-babel-pre-tangle-hook '(save-buffer) org-file-apps '((auto-mode . emacs) ("\\.odt\\'" . "libreoffice %s") ("\\.docx\\'" . "libreoffice %s") ("\\.xlsx\\'" . "libreoffice %s") ("\\.png\\'" . "xv %s") ("\\.jpg\\'" . "xv %s") ("\\.jpeg\\'" . "xv %s") ("\\.webp\\'" . "xv %s") ("\\.pdf\\'" . "okular \"%s\"") ("\\.xoj" . "xournal %s") ("\\.xopp" . "xournalpp %s")) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-hide-leading-stars t org-babel-load-languages '((R . t) (emacs-lisp . t) (gnuplot . t) (octave . t) (python . t) (fortran . t) (sql . t) (ditaa . t) (dot . t) (shell . t)) org-log-done 'time org-highlight-latex-and-related '(latex) org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-agenda-loop-over-headlines-in-active-region nil org-fontify-done-headline nil org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal org-occur-hook '(org-first-headline-recenter) org-log-into-drawer t org--warnings '("org-element--cache: Org parser error in scratch.org::8756. Resetting.\n The error was: (error \"Invalid search bound (wrong side of point)\")\n Backtrace:\nnil\n Please report this to Org mode mailing list (M-x org-submit-bug-report).") org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-cycle-optimize-window-after-visibility-change org-cycle-display-link-previews) org-todo-keywords '((sequence "TODO(t!)" "MAYBE(m!)" "STARTED(s!)" "WAITING(w@/!)" "|" "DONE(d)" "INFO(i!)" "CANCELLED(c@)" "UNFINISHED(u@)" "ABANDONED(a@)") ) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-yank-image-file-name-function 'org-yank-image-autogen-filename org-fold-catch-invisible-edits 'error org-babel-tangle-lang-exts '(("fortran" . "F90") ("python" . "py") ("emacs-lisp" . "el") ("elisp" . "el")) org-format-latex-options '(:foreground "Yellow" :background default :scale 1.2 :html-foreground "Black" :html-background "Transparent" :html-scale 1.07 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) org-clock-display-default-range 'untilnow org-export-before-parsing-hook '(org-attach-expand-links) org-confirm-shell-link-function 'yes-or-no-p org-link-parameters '(("attachment" :follow org-attach-follow :complete org-attach-complete-link :preview org-attach-preview-file) ("eww" :follow org-eww-open :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link :insert-description org-info-description-as-command) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("doi" :follow org-link-doi-open :export org-link-doi-export) ("id" :follow org-id-open :store org-id-store-link-maybe) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[514 "\301\300\302 Q \"\207" ["news" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("mailto" :follow #[514 "\301\300\302 Q \"\207" ["mailto" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("https" :follow #[514 "\301\300\302 Q \"\207" ["https" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("http" :follow #[514 "\301\300\302 Q \"\207" ["http" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("ftp" :follow #[514 "\301\300\302 Q \"\207" ["ftp" browse-url ":"] 6 "\n\n(fn URL ARG)"] ) ("help" :follow org-link--open-help :store org-link--store-help) ("file" :complete org-link-complete-file :preview org-link-preview-file) ("elisp" :follow org-link--open-elisp)) org-link-elisp-confirm-function 'yes-or-no-p org-todo-keyword-faces '(("TODO" :foreground "light pink" :weight bold) ("MAYBE" :foreground "light pink" :weight bold) ("STARTED" :foreground "gold" :weight bold) ("DONE" :foreground "light green" :weight bold) ("WAITING" :foreground "gold" :weight bold) ("CANCELLED" :foreground "light green" :weight bold) ("UNFINISHED" :foreground "light green" :weight bold) ("ABANDONED" :foreground "light green" :weight bold)) org-clock-into-drawer "CLOCK" org-clock-in-switch-to-state "STARTED" org-clock-out-remove-zero-time-clocks t org-confirm-babel-evaluate nil ) [-- Attachment #2: Type: text/html, Size: 10933 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] 2024-12-20 21:30 [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] Paul Stansell @ 2024-12-23 17:16 ` Ihor Radchenko 2024-12-23 18:02 ` Paul Stansell 0 siblings, 1 reply; 6+ messages in thread From: Ihor Radchenko @ 2024-12-23 17:16 UTC (permalink / raw) To: Paul Stansell; +Cc: emacs-orgmode Paul Stansell <paulstansell@gmail.com> writes: > Occasionally, when I start emacs from the command line, I get this bug, but > it's intermittent, > so I have ignored it until now. > > All I can report is that I opened an org file named scratch.org and > received the following error message: > > Warning (org-element): org-element--cache: Org parser error in > scratch.org::8756. Resetting. > The error was: (error "Invalid search bound (wrong side of point)") > Backtrace: > nil > Please report this to Org mode mailing list (M-x org-submit-bug-report). Thanks for reporting! May you add (setq org-element--cache-self-verify 'backtrace) to your config? This will enable extra logging that will provide more context about the error. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] 2024-12-23 17:16 ` Ihor Radchenko @ 2024-12-23 18:02 ` Paul Stansell 2024-12-23 18:08 ` Ihor Radchenko 0 siblings, 1 reply; 6+ messages in thread From: Paul Stansell @ 2024-12-23 18:02 UTC (permalink / raw) To: Ihor Radchenko; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 332 bytes --] Hello Ihor, May you add > (setq org-element--cache-self-verify 'backtrace) > to your config? Sure, I'll do that. In case it's relevant, I also frequently get warnings like the following: Warning (emacs): Emacs reader failed to read data in "~/.cache/org-persist//gc-lock.eld". The error was: "End of file during parsing" Paul [-- Attachment #2: Type: text/html, Size: 745 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] 2024-12-23 18:02 ` Paul Stansell @ 2024-12-23 18:08 ` Ihor Radchenko 2024-12-23 23:33 ` Paul Stansell 0 siblings, 1 reply; 6+ messages in thread From: Ihor Radchenko @ 2024-12-23 18:08 UTC (permalink / raw) To: Paul Stansell; +Cc: emacs-orgmode Paul Stansell <paulstansell@gmail.com> writes: > In case it's relevant, I also frequently get warnings like the following: > > Warning (emacs): Emacs reader failed to read data in > "~/.cache/org-persist//gc-lock.eld". The error was: "End of file during > parsing" May it be that you often have multiple Emacs processes running simultaneously and killed by signal? -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] 2024-12-23 18:08 ` Ihor Radchenko @ 2024-12-23 23:33 ` Paul Stansell 2024-12-24 9:00 ` Ihor Radchenko 0 siblings, 1 reply; 6+ messages in thread From: Paul Stansell @ 2024-12-23 23:33 UTC (permalink / raw) To: Ihor Radchenko; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 650 bytes --] > > May it be that you often have multiple Emacs processes running > simultaneously and killed by signal? > I do typically have multiple Emacs processes running simultaneously, but I'm not aware that I kill Emacs processes, I either quit Emacs with C-x C-c, or I click on the "X" in the top right of the window. Could the latter be sending a kill signal? By the way, I've exited Emacs by clicking the "X" for years, but I've only recently noticed the warnings. Also, if I switch to using the version of Org Mode that comes with the distribution (Kubuntu 22.04), instead of using the recent one from a git clone, I don't think I get the warmings. [-- Attachment #2: Type: text/html, Size: 926 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] 2024-12-23 23:33 ` Paul Stansell @ 2024-12-24 9:00 ` Ihor Radchenko 0 siblings, 0 replies; 6+ messages in thread From: Ihor Radchenko @ 2024-12-24 9:00 UTC (permalink / raw) To: Paul Stansell; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1192 bytes --] Paul Stansell <paulstansell@gmail.com> writes: >> >> May it be that you often have multiple Emacs processes running >> simultaneously and killed by signal? > > I do typically have multiple Emacs processes running simultaneously, but > I'm not aware that I kill Emacs processes, I either quit Emacs with C-x > C-c, or I click on the "X" in the top right of the window. Could the > latter be sending a kill signal? No idea :) In any case, your errors look like some kind of mixed state from multiple Emacs sessions writing to the same cache file. May you try the attached patch? > ... By the way, I've exited Emacs by clicking > the "X" for years, but I've only recently noticed the warnings. Also, if I > switch to using the version of Org Mode that comes with the distribution > (Kubuntu 22.04), instead of using the recent one from a git clone, I don't > think I get the warmings. That's because disk cache has been introduced in the recent Org mode versions. -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-persist-Fix-mixing-cace-data-from-multiple-Emacs.patch --] [-- Type: text/x-patch, Size: 4255 bytes --] From 15b8681c0c8db555b20d70b2a47cef996ff1cebf Mon Sep 17 00:00:00 2001 Message-ID: <15b8681c0c8db555b20d70b2a47cef996ff1cebf.1735030672.git.yantar92@posteo.net> From: Ihor Radchenko <yantar92@posteo.net> Date: Tue, 24 Dec 2024 09:45:42 +0100 Subject: [PATCH] org-persist: Fix mixing cace data from multiple Emacs processes * lisp/org-persist.el (org-persist--write-elisp-file): When there is a clash with other Emacs process while writing cache data, discard the cache to avoid any problem. (org-persist-write): Return nil when any kind of error occurs when writing. (org-persist--refresh-gc-lock): (org-persist--gc-orphan-p): Bail out when writing fails. Reported-by: Paul Stansell <paulstansell@gmail.com> Link: https://orgmode.org/list/YT3PR01MB95943D4DB2E659091A2BDE8DBE2E2@YT3PR01MB9594.CANPRD01.PROD.OUTLOOK.COM --- lisp/org-persist.el | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lisp/org-persist.el b/lisp/org-persist.el index 886d227c0a..788714fb15 100644 --- a/lisp/org-persist.el +++ b/lisp/org-persist.el @@ -478,11 +478,12 @@ (defun org-persist--write-elisp-file (file data &optional no-circular pp) (start-time (float-time))) (unless (file-exists-p (file-name-directory file)) (make-directory (file-name-directory file) t)) - ;; Force writing even when the file happens to be opened by - ;; another Emacs process. + ;; Discard cache when there is a clash with other Emacs process. + ;; This way, we make sure that cache is never mixing data & record + ;; from different processes. (cl-letf (((symbol-function #'ask-user-about-lock) - ;; FIXME: Emacs 27 does not yet have `always'. - (lambda (&rest _) t))) + (lambda (&rest _) + (error "Other Emacs process is writing to cache")))) (with-temp-file file (insert ";; -*- mode: lisp-data; -*-\n") (if pp @@ -1120,12 +1121,13 @@ (defun org-persist-write (container &optional associated ignore-return) (seq-find (lambda (v) (run-hook-with-args-until-success 'org-persist-before-write-hook v associated)) (plist-get collection :container))) - (when (or (file-exists-p org-persist-directory) (org-persist--save-index)) - (let ((file (org-file-name-concat org-persist-directory (plist-get collection :persist-file))) - (data (mapcar (lambda (c) (cons c (org-persist-write:generic c collection))) - (plist-get collection :container)))) - (org-persist--write-elisp-file file data) - (or ignore-return (org-persist-read container associated))))))) + (ignore-errors + (when (or (file-exists-p org-persist-directory) (org-persist--save-index)) + (let ((file (org-file-name-concat org-persist-directory (plist-get collection :persist-file))) + (data (mapcar (lambda (c) (cons c (org-persist-write:generic c collection))) + (plist-get collection :container)))) + (org-persist--write-elisp-file file data) + (or ignore-return (org-persist-read container associated)))))))) (defun org-persist-write-all (&optional associated) "Save all the persistent data. @@ -1226,7 +1228,7 @@ (defun org-persist--refresh-gc-lock () (when (< (- (float-time (cdr record)) (float-time (current-time))) org-persist-gc-lock-expiry) (push record new-alist))) - (org-persist--write-elisp-file file new-alist))) + (ignore-errors (org-persist--write-elisp-file file new-alist)))) (defun org-persist--gc-orphan-p () "Return non-nil, when orphan files should be garbage-collected. @@ -1234,7 +1236,7 @@ (defun org-persist--gc-orphan-p () (let* ((file (org-file-name-concat org-persist-directory org-persist-gc-lock-file)) (alist (when (file-exists-p file) (org-persist--read-elisp-file file)))) (setq alist (org-assoc-delete-all before-init-time alist)) - (org-persist--write-elisp-file file alist) + (ignore-errors (org-persist--write-elisp-file file alist)) ;; Only GC orphan files when there are no active sessions. (not alist))) -- 2.47.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-12-24 9:00 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-12-20 21:30 [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] Paul Stansell 2024-12-23 17:16 ` Ihor Radchenko 2024-12-23 18:02 ` Paul Stansell 2024-12-23 18:08 ` Ihor Radchenko 2024-12-23 23:33 ` Paul Stansell 2024-12-24 9:00 ` 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).