GNU bug report logs - #75209
30.0.93; Emacs reader failed to read data in "/home/nlj/.cache/org-persist/gc-lock.eld"

Previous Next

Package: emacs;

Reported by: "N. Jackson" <njackson <at> posteo.net>

Date: Mon, 30 Dec 2024 18:49:01 UTC

Severity: normal

Found in version 30.0.93

Full log


View this message in rfc822 format

From: Ihor Radchenko <yantar92 <at> posteo.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 75209 <at> debbugs.gnu.org, "N. Jackson" <njackson <at> posteo.net>
Subject: bug#75209: 30.0.93; Emacs reader failed to read data in "/home/nlj/.cache/org-persist/gc-lock.eld"
Date: Sat, 15 Mar 2025 16:05:44 +0000
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

> Hmm... but now I see that the previous code already renamed the file
> with the new data after the new data was completely written, is that
> right?  If so, I don't think this last change will help, and we need
> to understand how come rename-file doesn't already solve this problem.

Yes, it is right.
You suggested using write to temporary file -> rename method earlier and
I implemented it.

> Is the file being read and written a regular file or a symlink?

Regular file.

> One thing to try is to let-bind write-region-inhibit-fsync to a nil
> value around the code which writes the data to the org-persist file.
> Maybe we have some tricky race condition between the filesystem
> flushing its buffer after one instance of Emacs wrote the file, and
> the other instance of Emacs that opens the file for reading.

The attached diff does it. Need to test.

[enable-fsync.diff (text/x-patch, inline)]
diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index a639699d93..c0a0dd53d6 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -474,7 +474,7 @@ (defun org-persist--write-elisp-file
   ;;
   ;; To read more about this, see the comments in Emacs's fileio.c, in
   ;; particular the large comment block in init_fileio.
-  (let ((write-region-inhibit-fsync t)
+  (let ((write-region-inhibit-fsync nil)
         ;; We set UTF-8 here and in `org-persist--read-elisp-file'
         ;; to avoid the overhead from `find-auto-coding'.
         (coding-system-for-write 'emacs-internal)
[Message part 3 (text/plain, inline)]
-- 
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>

This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.