emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tom Gillespie <tgbugs@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>,
	Ihor Radchenko <yantar92@gmail.com>
Subject: org-persist-gc and tramp
Date: Fri, 27 May 2022 14:46:52 -0700	[thread overview]
Message-ID: <CA+G3_PNOhG8mECeC87sdPDK-tjZMFGOdFm92Eviir85E-7Zi7A@mail.gmail.com> (raw)

While debugging an unrelated issue I noticed that
tramp was initiating a new connection every time
save-buffers-kill-emacs ran. I eventually tracked it
down to org-persist-gc running on kill-emacs-hook.

It turns out that org-persist--index held a record
for a remote file, and the transparency of tramp
means that emacs will happily open any number
of remote connections to check whether such files
exist on exit. This could produce unexpected and
quite bad behavior for users that edit many remote
org files. It also leaks information that a user has
closed emacs over the network even if they have
not intentionally made any remote connections.

I see a couple potential fixes.
- skip gc for remote files
- never persist remote files
- +only gc remote files when their cache is expired+

I think the last option might be the most reasonable
compromise? Er, nope, I was looking at an old/variant
cache location that still had :expiry values in the plist,
but it looks like the most recent version does not, so
we are left with option 1 or option 2.

Given that the network latency is likely to dominate
accessing such files the time to reparse if we don't
persist (option 2) seems like it will be small?

I think for option 1 to work safely there would need
to be a way to periodically gc remote files, maybe
when another file on that remote was accessed so
an existing tramp connection would be used?

Thoughts?
Tom


             reply	other threads:[~2022-05-27 21:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 21:46 Tom Gillespie [this message]
2022-05-27 22:31 ` org-persist-gc and tramp Ihor Radchenko
2022-05-27 23:35   ` Tom Gillespie
2022-05-28  0:14     ` Ihor Radchenko
2022-05-28  2:32       ` Tom Gillespie

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+G3_PNOhG8mECeC87sdPDK-tjZMFGOdFm92Eviir85E-7Zi7A@mail.gmail.com \
    --to=tgbugs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=yantar92@gmail.com \
    /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 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).