* [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
@ 2024-05-15 5:37 Greg Minshall
2024-05-17 11:31 ` Ihor Radchenko
0 siblings, 1 reply; 11+ messages in thread
From: Greg Minshall @ 2024-05-15 5:37 UTC (permalink / raw)
To: emacs-orgmode
Remember to cover the basics, that is, what you expected to happen and
what in fact did happen. You don't know how to make a good report? See
https://orgmode.org/manual/Feedback.html#Feedback
Your bug report will be posted to the Org mailing list.
------------------------------------------------------------------------
i run various Emacs instances, in each of which i run org. i frequently
get these messages (followed by errors when i reply 'q'):
----
...rg-persist/gc-lock.eld locked by minshall@arch... (pid 546721): (s, q, p, ?)?
Error running timer ‘org-persist--refresh-gc-lock’: (file-locked "/home/minshall/.cache/org-persist/gc-lock.eld" "minshall@archlinux (pid 546721)")
----
since i don't see a PID in the lock file name (i assume it is), i wonder
if the code occasionally has this problem when more than one instance
attempts to acquire this lock at a time?
cheers!
Emacs : GNU Emacs 30.0.50 (build 14, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0)
of 2023-11-20
Package: Org mode version 9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-15 5:37 [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)] Greg Minshall
@ 2024-05-17 11:31 ` Ihor Radchenko
2024-05-17 17:15 ` Greg Minshall
2024-05-19 3:12 ` Greg Minshall
0 siblings, 2 replies; 11+ messages in thread
From: Ihor Radchenko @ 2024-05-17 11:31 UTC (permalink / raw)
To: Greg Minshall; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
Greg Minshall <minshall@umich.edu> writes:
> i run various Emacs instances, in each of which i run org. i frequently
> get these messages (followed by errors when i reply 'q'):
> ----
> ...rg-persist/gc-lock.eld locked by minshall@arch... (pid 546721): (s, q, p, ?)?
> Error running timer ‘org-persist--refresh-gc-lock’: (file-locked "/home/minshall/.cache/org-persist/gc-lock.eld" "minshall@archlinux (pid 546721)")
> ----
>
> since i don't see a PID in the lock file name (i assume it is), i wonder
> if the code occasionally has this problem when more than one instance
> attempts to acquire this lock at a time?
In theory, the odds should be quite slim, unless you open that file
manually. Anyway...
Does the attached patch fix the problem for you?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-org-persist.el-Ignore-lock-files-when-writing-c.patch --]
[-- Type: text/x-patch, Size: 1262 bytes --]
From 7f208e8802ed10017cce094114d395698523beec Mon Sep 17 00:00:00 2001
Message-ID: <7f208e8802ed10017cce094114d395698523beec.1715945418.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Fri, 17 May 2024 14:28:48 +0300
Subject: [PATCH] lisp/org-persist.el: Ignore lock files when writing cache
* lisp/org-persist.el (org-persist--write-elisp-file): Unlock file
before writing cache.
Reported-by: Greg Minshall <minshall@umich.edu>
Link: https://orgmode.org/list/574109.1715751441@archlinux
---
lisp/org-persist.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index 0df345536..a8fc77c95 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -481,7 +481,10 @@ (defun org-persist--write-elisp-file (file data &optional no-circular pp)
(if pp
(let ((pp-use-max-width nil)) ; Emacs bug#58687
(pp data (current-buffer)))
- (prin1 data (current-buffer))))
+ (prin1 data (current-buffer)))
+ ;; Force writing even when the file happens to be opened by
+ ;; another Emacs process.
+ (unlock-buffer))
(org-persist--display-time
(- (float-time) start-time)
"Writing to %S" file)))
--
2.45.1
[-- Attachment #3: Type: text/plain, Size: 224 bytes --]
--
Ihor Radchenko // yantar92,
Org mode contributor,
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 related [flat|nested] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-17 11:31 ` Ihor Radchenko
@ 2024-05-17 17:15 ` Greg Minshall
2024-05-19 3:12 ` Greg Minshall
1 sibling, 0 replies; 11+ messages in thread
From: Greg Minshall @ 2024-05-17 17:15 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Ihor,
> In theory, the odds should be quite slim, unless you open that file
> manually. Anyway...
as the saying goes, the difference between theory and practice is that
in theory there is no difference, but in practice there is. :)
> Does the attached patch fix the problem for you?
i've applied it, and i'll let you know how it goes in a week or so (it
typically occurs several times per day, so a week without it should be
pretty strong evidence for the patch working).
cheers, Greg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-17 11:31 ` Ihor Radchenko
2024-05-17 17:15 ` Greg Minshall
@ 2024-05-19 3:12 ` Greg Minshall
2024-05-19 11:41 ` Ihor Radchenko
1 sibling, 1 reply; 11+ messages in thread
From: Greg Minshall @ 2024-05-19 3:12 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
hi, Ihor,
i have a recurrence of the same problem. see below.
cheers, Greg
----
Subject: [BUG] still fails... [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
Fcc: outbox
X-Mailer: MH-E 8.6+git; nmh 1.8; Emacs 30.0.50
--------
> ...rg-persist/gc-lock.eld locked by minshall@arch... (pid 630467): (s, q, p, ?)?
> Error running timer ‘org-persist--refresh-gc-lock’: (file-locked "/home/minshall/.cache/org-persist/gc-lock.eld" "minshall@archlinux (pid 630467)")
(following [C-h f org-persist<mumble>], then goto line 481):
~/.emacs.d/straight/repos/org/lisp/org-persist.el
----
(if pp
(let ((pp-use-max-width nil)) ; Emacs bug#58687
(pp data (current-buffer)))
(prin1 data (current-buffer)))
;; Force writing even when the file happens to be opened by
;; another Emacs process.
(unlock-buffer))
----
and
: lrwxrwxrwx 1 minshall minshall 62 May 17 20:11 /home/minshall/.emacs.d/straight/build/org/org-persist.el -> /home/minshall/.emacs.d/straight/repos/org/lisp/org-persist.el
Emacs : GNU Emacs 30.0.50 (build 14, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0)
of 2023-11-20
Package: Org mode version 9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-19 3:12 ` Greg Minshall
@ 2024-05-19 11:41 ` Ihor Radchenko
2024-05-22 4:09 ` Greg Minshall
0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2024-05-19 11:41 UTC (permalink / raw)
To: Greg Minshall; +Cc: emacs-orgmode
Greg Minshall <minshall@umich.edu> writes:
> i have a recurrence of the same problem. see below.
> ...
>> ...rg-persist/gc-lock.eld locked by minshall@arch... (pid 630467): (s, q, p, ?)?
>> Error running timer ‘org-persist--refresh-gc-lock’: (file-locked "/home/minshall/.cache/org-persist/gc-lock.eld" "minshall@archlinux (pid 630467)")
Then, I need a backtrace. May you please enable debug-on-error and share it?
--
Ihor Radchenko // yantar92,
Org mode contributor,
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] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-19 11:41 ` Ihor Radchenko
@ 2024-05-22 4:09 ` Greg Minshall
2024-05-22 9:38 ` Ihor Radchenko
0 siblings, 1 reply; 11+ messages in thread
From: Greg Minshall @ 2024-05-22 4:09 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
hi, Ihor,
> Then, I need a backtrace. May you please enable debug-on-error and share it?
here is a backtrace. is this enough, or should i do something extra to
give you more information from it?
the situation was: "it" put up the message
----
...rg-persist/gc-lock.eld locked by minshall@arch... (pid 630467): (s, q, p, ?)?
----
and i answered 'q'.
cheers, Greg
----
Debugger entered--Lisp error: (file-locked "/home/minshall/.cache/org-persist/gc-lock.eld" "minshall@archlinux (pid 630467)")
signal(file-locked ("/home/minshall/.cache/org-persist/gc-lock.eld" "minshall@archlinux (pid 630467)"))
ask-user-about-lock("/home/minshall/.cache/org-persist/gc-lock.eld" "minshall@archlinux (pid 630467)")
write-region(nil nil "/home/minshall/.cache/org-persist/gc-lock.eld" nil 0)
org-persist--write-elisp-file("/home/minshall/.cache/org-persist/gc-lock.eld" (((26183 36837 959155 597000) 26189 28499 728982 83000) ((26183 36842 638577 324000) 26189 28499 729139 115000)))
org-persist--refresh-gc-lock()
apply(org-persist--refresh-gc-lock nil)
timer-event-handler([t 26189 24417 539879 3600 org-persist--refresh-gc-lock nil nil 962000 nil])
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-22 4:09 ` Greg Minshall
@ 2024-05-22 9:38 ` Ihor Radchenko
2024-05-22 17:13 ` Greg Minshall
2024-05-30 7:19 ` Greg Minshall
0 siblings, 2 replies; 11+ messages in thread
From: Ihor Radchenko @ 2024-05-22 9:38 UTC (permalink / raw)
To: Greg Minshall; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 290 bytes --]
Greg Minshall <minshall@umich.edu> writes:
>> Then, I need a backtrace. May you please enable debug-on-error and share it?
>
> here is a backtrace. is this enough, or should i do something extra to
> give you more information from it?
Yeah.
May you try the attached alternative patch?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-lisp-org-persist.el-Ignore-lock-files-when-writin.patch --]
[-- Type: text/x-patch, Size: 1723 bytes --]
From 793f7df996b3aade65a66d936e4bd761af154b26 Mon Sep 17 00:00:00 2001
Message-ID: <793f7df996b3aade65a66d936e4bd761af154b26.1716370593.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Fri, 17 May 2024 14:28:48 +0300
Subject: [PATCH v2] lisp/org-persist.el: Ignore lock files when writing cache
* lisp/org-persist.el (org-persist--write-elisp-file): Ignore locks.
Reported-by: Greg Minshall <minshall@umich.edu>
Link: https://orgmode.org/list/574109.1715751441@archlinux
---
lisp/org-persist.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index 0df345536..8a7461649 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -476,12 +476,15 @@ (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))
- (with-temp-file file
- (insert ";; -*- mode: lisp-data; -*-\n")
- (if pp
- (let ((pp-use-max-width nil)) ; Emacs bug#58687
- (pp data (current-buffer)))
- (prin1 data (current-buffer))))
+ ;; Force writing even when the file happens to be opened by
+ ;; another Emacs process.
+ (cl-letf (((symbol-function #'ask-user-about-lock) #'always))
+ (with-temp-file file
+ (insert ";; -*- mode: lisp-data; -*-\n")
+ (if pp
+ (let ((pp-use-max-width nil)) ; Emacs bug#58687
+ (pp data (current-buffer)))
+ (prin1 data (current-buffer)))))
(org-persist--display-time
(- (float-time) start-time)
"Writing to %S" file)))
--
2.45.1
[-- Attachment #3: Type: text/plain, Size: 224 bytes --]
--
Ihor Radchenko // yantar92,
Org mode contributor,
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 related [flat|nested] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-22 9:38 ` Ihor Radchenko
@ 2024-05-22 17:13 ` Greg Minshall
2024-05-30 7:19 ` Greg Minshall
1 sibling, 0 replies; 11+ messages in thread
From: Greg Minshall @ 2024-05-22 17:13 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Ihor,
> May you try the attached alternative patch?
thanks, will do.
cheers, Greg
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-22 9:38 ` Ihor Radchenko
2024-05-22 17:13 ` Greg Minshall
@ 2024-05-30 7:19 ` Greg Minshall
2024-05-30 13:32 ` Ihor Radchenko
1 sibling, 1 reply; 11+ messages in thread
From: Greg Minshall @ 2024-05-30 7:19 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Ihor,
> May you try the attached alternative patch?
it's been a week that i've been running this patch without seeing the
error messages (that used to come up once or more per day).
so, it would seem to have corrected the issue.
thanks again for looking at this.
cheers, Greg
> From 793f7df996b3aade65a66d936e4bd761af154b26 Mon Sep 17 00:00:00 2001
> Message-ID: <793f7df996b3aade65a66d936e4bd761af154b26.1716370593.git.yantar92@posteo.net>
> From: Ihor Radchenko <yantar92@posteo.net>
> Date: Fri, 17 May 2024 14:28:48 +0300
> Subject: [PATCH v2] lisp/org-persist.el: Ignore lock files when writing cache
>
> * lisp/org-persist.el (org-persist--write-elisp-file): Ignore locks.
>
> Reported-by: Greg Minshall <minshall@umich.edu>
> Link: https://orgmode.org/list/574109.1715751441@archlinux
> ---
> lisp/org-persist.el | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/lisp/org-persist.el b/lisp/org-persist.el
> index 0df345536..8a7461649 100644
> --- a/lisp/org-persist.el
> +++ b/lisp/org-persist.el
> @@ -476,12 +476,15 @@ (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))
> - (with-temp-file file
> - (insert ";; -*- mode: lisp-data; -*-\n")
> - (if pp
> - (let ((pp-use-max-width nil)) ; Emacs bug#58687
> - (pp data (current-buffer)))
> - (prin1 data (current-buffer))))
> + ;; Force writing even when the file happens to be opened by
> + ;; another Emacs process.
> + (cl-letf (((symbol-function #'ask-user-about-lock) #'always))
> + (with-temp-file file
> + (insert ";; -*- mode: lisp-data; -*-\n")
> + (if pp
> + (let ((pp-use-max-width nil)) ; Emacs bug#58687
> + (pp data (current-buffer)))
> + (prin1 data (current-buffer)))))
> (org-persist--display-time
> (- (float-time) start-time)
> "Writing to %S" file)))
> --
> 2.45.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-30 7:19 ` Greg Minshall
@ 2024-05-30 13:32 ` Ihor Radchenko
2024-06-02 7:25 ` Greg Minshall
0 siblings, 1 reply; 11+ messages in thread
From: Ihor Radchenko @ 2024-05-30 13:32 UTC (permalink / raw)
To: Greg Minshall; +Cc: emacs-orgmode
Greg Minshall <minshall@umich.edu> writes:
> Ihor,
>
>> May you try the attached alternative patch?
>
> it's been a week that i've been running this patch without seeing the
> error messages (that used to come up once or more per day).
>
> so, it would seem to have corrected the issue.
Fixed, on main.
I used a slightly different patch, because `always' is not available in
Emacs 27.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=dc485a659
--
Ihor Radchenko // yantar92,
Org mode contributor,
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] 11+ messages in thread
* Re: [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)]
2024-05-30 13:32 ` Ihor Radchenko
@ 2024-06-02 7:25 ` Greg Minshall
0 siblings, 0 replies; 11+ messages in thread
From: Greg Minshall @ 2024-06-02 7:25 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
Ihor,
> Fixed, on main.
> I used a slightly different patch, because `always' is not available in
> Emacs 27.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=dc485a659
thanks!
cheers, Greg
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-06-02 7:27 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-15 5:37 [BUG] cache file conflict? [9.7-pre (release_9.6.29-1441-gaa71fa @ /home/minshall/.emacs.d/straight/build/org/)] Greg Minshall
2024-05-17 11:31 ` Ihor Radchenko
2024-05-17 17:15 ` Greg Minshall
2024-05-19 3:12 ` Greg Minshall
2024-05-19 11:41 ` Ihor Radchenko
2024-05-22 4:09 ` Greg Minshall
2024-05-22 9:38 ` Ihor Radchenko
2024-05-22 17:13 ` Greg Minshall
2024-05-30 7:19 ` Greg Minshall
2024-05-30 13:32 ` Ihor Radchenko
2024-06-02 7:25 ` Greg Minshall
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).