From: Eli Zaretskii <eliz@gnu.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: 75209@debbugs.gnu.org, njackson@posteo.net
Subject: bug#75209: 30.0.93; Emacs reader failed to read data in "/home/nlj/.cache/org-persist/gc-lock.eld"
Date: Thu, 02 Jan 2025 20:48:42 +0200 [thread overview]
Message-ID: <86y0zthx11.fsf@gnu.org> (raw)
In-Reply-To: <87y0ztqg65.fsf@localhost> (message from Ihor Radchenko on Thu, 02 Jan 2025 17:28:02 +0000)
> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: njackson@posteo.net, 75209@debbugs.gnu.org
> Date: Thu, 02 Jan 2025 17:28:02 +0000
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > Can you tell more about the purpose and use of this file? What is
> > written to it, and how is it supposed to be used after being written?
> > And what bad things happen when the Lisp readers errors out because it
> > is unable to read the data for some reason?
>
> Let me then describe briefly what org-persist does.
>
> In the nutshell, it is cache manager.
> The main cache data consists of:
> 1. index describing everything stored in the cache and its expiry
> settings
> 2. cache data stored in individual files. Each file in the cache is
> mentioned in the index file
>
> >From time to time (before quitting Emacs), org-persist needs to do some
> "garbage collection" and remove cache files that are expired or
> unreferenced from index to avoid cache growing infinitely.
>
> The GC process works well, and helps keeping the cache directory
> clean. However, there are problems when multiple Emacs processes are
> running simultaneously.
>
> Consider Emacs A loading cache index into memory and doing nothing.
> Then, Emacs B also loads the cache index, but adds data to the cache.
> If Emacs A is closed while Emacs B is running (and Emacs B not yet
> updating cache index on disk), it also performs garbage
> collection. However, Emacs A has no knowledge about cache data written
> by Emacs B and may "garabge collect" this data. We do not want that.
Thanks. I think I still don't have a clear idea of the usage of these
caches. Are the caches supposed to be common to all Emacs sessions?
E.g., when a cache changes by one session, are other sessions supposed
to know about the change? If the cache is for a single session, then
why are several session allowed to write to the cache simultaneously?
And if the cache is common to all sessions, then perhaps reading the
index before writing it should avoid several sessions step on each
other's toes?
> "gc-lock.eld" keeps track of the running Emacs processes - every Emacs
> process regularly write to "gc-lock.eld", putting a record in the form
> of (before-init-time . <last known time that Emacs is running>). If
> there are no known recently running Emacs processes (apart from
> current), garbage collection process is suppressed to avoid removing
> cache data from other Emacsen.
One way of rewriting a file atomically is to write the stuff to a
temporary file, then rename it to the target name. If Org doesn't
already do that, maybe you should try doing that (together with
reading the file before updating it)?
next prev parent reply other threads:[~2025-01-02 18:48 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 18:48 bug#75209: 30.0.93; Emacs reader failed to read data in "/home/nlj/.cache/org-persist/gc-lock.eld" N. Jackson
2024-12-30 19:31 ` Eli Zaretskii
[not found] ` <87zfkddk1l.fsf@Phoenix>
2024-12-30 20:01 ` Eli Zaretskii
2025-01-01 17:41 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-01 18:52 ` Eli Zaretskii
2025-01-01 21:09 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-31 17:42 ` Ihor Radchenko
[not found] ` <87frm3elkr.fsf@Phoenix>
2024-12-31 19:02 ` Ihor Radchenko
2024-12-31 19:54 ` Eli Zaretskii
2025-01-01 9:42 ` Ihor Radchenko
2025-01-01 12:14 ` Eli Zaretskii
2025-01-02 17:28 ` Ihor Radchenko
2025-01-02 18:48 ` Eli Zaretskii [this message]
2025-01-05 10:03 ` Ihor Radchenko
2025-01-05 11:15 ` Eli Zaretskii
2025-01-05 13:18 ` Ihor Radchenko
2025-01-01 15:54 ` N. Jackson
2025-01-02 13:34 ` N. Jackson
2025-01-05 14:18 ` N. Jackson
2025-01-05 17:21 ` Eli Zaretskii
2025-01-06 0:58 ` N. Jackson
2025-01-06 13:49 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86y0zthx11.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=75209@debbugs.gnu.org \
--cc=njackson@posteo.net \
--cc=yantar92@posteo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.