From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id SGKkLip4amf5SgEAe85BDQ:P1 (envelope-from ) for ; Tue, 24 Dec 2024 09:00:26 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id SGKkLip4amf5SgEAe85BDQ (envelope-from ) for ; Tue, 24 Dec 2024 10:00:26 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=UQd5HpPQ; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1735030826; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=s8XrxBiy/YtZGQkPX0G5WEOJYV49KHvzOfTsKlo5GUk=; b=GyUXruF2W8uacImTsJjqBhgZpBM74XdW2aLYltfXYkZwofmZfO1PqwB+T/mH2LZeE/HY+h dB5MAcfbN4L0UPzPGLQy8h5r0GJai31g8KpOKTwE42K21UtguMRf/VfE5ETOO7KPbbSseM e42pderUDJ797kw6fFs5qg2T6iJJsH95iHB/+0i9y+TJzVv/vmhq4qAc3k8wz64UhFj1vK pB2bvs4xtc5Jf2HHDQCzXa7Xr3Kz+e5H+I1omSzGd9kHvmYNbi4OMcuS/GmJ2AHP44GUW2 HERR7+VnuXah+oDyqf91n7n6qomzMTl1xbepdx4LkVx/mqbsILrMSCW3Dm1RGA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=UQd5HpPQ; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=posteo.net ARC-Seal: i=1; s=key1; d=yhetil.org; t=1735030826; a=rsa-sha256; cv=none; b=DjGPuyk6XqrlpTouhbFglt9sn1IRI31DuARhKiH91+YVqw4KSBtUCAVK6jKYGvhthyuipU 0R9AXP4V83ZQWRhbJzLUY5E67zkLzimOdSAI1xsFtMvS1Jze7lyU4OU6A0kp0NVNvrKtPJ wkhclPUAcx57I9wnHhcjVW9RrOy622POMS0zWLvg17og8CwYTTGXpwBZPEV2OA/rX+6J6u twG2a05SgzDHzAFQOW7ES2Kf/jmitszDH5fMOMj+UT13hgmotXytwOIYMowdqDfRyaPibe HttooNALiKGKgq+CAsayHpvn/0qbcHnCVTZ33iMtDXvr4uY7CGcyh0361shCeA== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 3BD9258470 for ; Tue, 24 Dec 2024 10:00:26 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQ0lI-00062I-Vd; Tue, 24 Dec 2024 03:59:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQ0lG-000622-Md for emacs-orgmode@gnu.org; Tue, 24 Dec 2024 03:59:30 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQ0lC-00058B-71 for emacs-orgmode@gnu.org; Tue, 24 Dec 2024 03:59:29 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 3FD30240101 for ; Tue, 24 Dec 2024 09:59:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1735030763; bh=xeIemPrDKM479WjvlrI9xmcGXt4sN0epoB4TuuW9H4k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=UQd5HpPQZE8BedmQIwvzUEI479QHj6BLi8O8CcNRC3xxcvusfR/h5j+Xw+iQgAx+3 ZnuR0SSRMepL5MMaviUyyy/SOwfT7ylQyVPhx3X0iW8c5u+v77X09nKTn94B1EXVtW qcAB9nxnYNcRUtC7ftgbg5/xMabi5FMvMH9zdUSqHaS9T/hREBkakSA4f2Yqn5sGeb dA3Gt1YVfBIJMJmmqJzWiAhwndsIn/QPurcm8jkgKM6hItk4jHMyorQ+9sM9Ab5Z/4 +xt17f5qHjbgjvNQhcM1rEJwqPP/u8rG8Oe6TG7S9/wdp9AT3oI0+aJYeKd3BJR25L ARhvpTU0AKUcg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YHTNB3vXFz6ty8; Tue, 24 Dec 2024 09:59:22 +0100 (CET) From: Ihor Radchenko To: Paul Stansell Cc: emacs-orgmode@gnu.org Subject: Re: [BUG] "Invalid search bound (wrong side of point)" [9.8-pre (release_9.7.16-169-ge87ecf @ ~/.emacs.d/org-mode-git/lisp/)] In-Reply-To: References: <87ldw6jp5s.fsf@localhost> <87zfkmi86w.fsf@localhost> Date: Tue, 24 Dec 2024 09:00:50 +0000 Message-ID: <87wmfpihfh.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 3BD9258470 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 1.50 X-Spam-Score: 1.50 X-TUID: M6zX3vynAOem --=-=-= Content-Type: text/plain Paul Stansell 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 . Support Org development at , or support my work at --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-persist-Fix-mixing-cace-data-from-multiple-Emacs.patch >From 15b8681c0c8db555b20d70b2a47cef996ff1cebf Mon Sep 17 00:00:00 2001 Message-ID: <15b8681c0c8db555b20d70b2a47cef996ff1cebf.1735030672.git.yantar92@posteo.net> From: Ihor Radchenko 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 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 --=-=-=--