emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-persist-gc and tramp
@ 2022-05-27 21:46 Tom Gillespie
  2022-05-27 22:31 ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Gillespie @ 2022-05-27 21:46 UTC (permalink / raw)
  To: emacs-orgmode, Ihor Radchenko

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-28  2:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-27 21:46 org-persist-gc and tramp Tom Gillespie
2022-05-27 22:31 ` Ihor Radchenko
2022-05-27 23:35   ` Tom Gillespie
2022-05-28  0:14     ` Ihor Radchenko
2022-05-28  2:32       ` Tom Gillespie

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).