Thanks for the report! Let me take a look at this and see what we can do.

Owned. (for BARK)

Cheers,

Derek

On Sat, Sep 19, 2026 at 8:04 PM Toomas Rosin <[email protected]> wrote:

>
> 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 think there is a sign error in `org-persist--refresh-gc-lock` that
> prevents old sessions from ever expiring from `gc-lock.eld`.
>
> In Org 9.7.11, the relevant code is:
>
> ```
> (dolist (record alist)
>   (when (< (- (float-time (cdr record))
>               (float-time (current-time)))
>            org-persist-gc-lock-expiry)
>     (push record new-alist)))
> ```
>
> `org-persist-gc-lock-expiry` defaults to one day.  However, for any record
> whose timestamp is in the past,
>
> ```
> (- (float-time (cdr record))
>    (float-time (current-time)))
> ```
>
> is negative, and is therefore always less than the positive expiry value.
>
> For example, a record that is 100 days old gives approximately
>
> ```
> -8640000 < 86400
> ```
>
> so the record is retained instead of being discarded.
>
> I noticed this because my `~/.emacs.d/org-persist/gc-lock.eld` currently
> contains 147 session records, although only 3 Emacs processes are running.
> There are also 41 files under `org-persist`, while only 16 `:container`
> entries in `index.eld` refer to persist files.  Thus a substantial number
> of orphan persist files have accumulated.
>
> This also appears to prevent orphan-file garbage collection.
> `org-persist-gc` only collects orphan files when `org-persist--gc-orphan-p`
> determines that there are no other active sessions.  Since stale session
> records never expire from `gc-lock.eld`, that condition may never be
> reached.
>
> It looks as though the test should instead be:
>
> ```
> (dolist (record alist)
>   (when (< (- (float-time (current-time))
>               (float-time (cdr record)))
>            org-persist-gc-lock-expiry)
>     (push record new-alist)))
> ```
>
> That is, the operands of the subtraction should be reversed.
>
> I also checked the current Org source and, unless I am overlooking
> something, the same expression is still present there.
>
> Could you confirm whether this is a bug?
>
> ------------------------------------------------------------------------
>
> Emacs  : GNU Emacs 30.2 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
> version 1.18.4)
>  of 2026-08-09
> Package: Org mode version 9.7.11 (release_9.7.11 @
> /usr/share/emacs/30.2/lisp/org/)
>
> current state:
> ==============
> (setq
>  org-yank-image-file-name-function 'org-yank-image-autogen-filename
>  org-persist-before-write-hook '(org-element--cache-persist-before-write)
>  org-html-format-headline-function
> 'org-html-format-headline-default-function
>  org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME
> CONTENTS)"]
>  org-pretty-entities t
>  org-agenda-todo-ignore-scheduled 'future
>  org-latex-format-inlinetask-function
> 'org-latex-format-inlinetask-default-function
>  org-preview-latex-process-alist '((dvisvgm :programs ("latex" "dvisvgm")
> :description
>                                     "dvi > svg" :message
>                                     "Install latex and dvisvgm to enable
> LaTeX previews."
>                                     :image-input-type "dvi"
> :image-output-type "svg"
>                                     :image-size-adjust (1.0 . 1.0)
> :latex-compiler
>                                     ("latex -interaction=nonstopmode
> -output-directory=%o %f")
>                                     :image-converter ("dvisvgm %f -n -b
> min -o %O"))
>                                    )
>  org-structure-template-alist '(("e" . "example") ("s" . "source"))
>  org-speed-command-hook '(org-speed-command-activate
> org-babel-speed-command-activate)
>  org-persist-after-read-hook '(org-element--cache-persist-after-read)
>  org-agenda-todo-ignore-time-comparison-use-seconds t
>  org-repeat-daytimes-mode t
>  org-confirm-elisp-link-function 'yes-or-no-p
>  org-agenda-finalize-hook '(org-agenda-go-to-next)
>  org-latex-format-headline-function
> 'org-latex-format-headline-default-function
>  org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
>  org-mode-hook '(#[0 "\301\211\207" [imenu-create-index-function
> org-imenu-get-tree] 2]
>                  C-c-SPC-is-nbsp org-tempo-setup infinite-fill-column
> turn-on-visual-line-mode
>                  turn-on-auto-fill
>                  #[0 "\300\301\302\303\304$\207"
>                    [add-hook change-major-mode-hook org-fold-show-all
> append local] 5]
>                  #[0 "\300\301\302\303\304$\207"
>                    [add-hook change-major-mode-hook
> org-babel-show-result-all append local] 5]
>                  org-babel-result-hide-spec org-babel-hide-all-hashes)
>  org-hide-emphasis-markers t
>  org-agenda-cmp-user-defined 'my-org-agenda-cmp
>  org-confirm-shell-link-function 'yes-or-no-p
>  org-odt-format-headline-function 'org-odt-format-headline-default-function
>  org-archive-hook '(org-attach-archive-delete-maybe)
>  org-metaup-hook '(org-babel-load-in-session-maybe)
>  org-agenda-start-with-follow-mode t
>  org-occur-hook '(org-first-headline-recenter)
>  org-agenda-skip-function-global 'org-repeat-agenda-skip-function
>  org-html-format-inlinetask-function
> 'org-html-format-inlinetask-default-function
>  org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME CONTENTS
> WIDTH)"]
>  org-bibtex-headline-format-function 'org-bibtex-headline-format-default
>  org-link-parameters '(("eww" :follow org-eww-open :store
> org-eww-store-link)
>                        ("rmail" :follow org-rmail-open :store
> org-rmail-store-link)
>                        ("mhe" :follow org-mhe-open :store
> org-mhe-store-link)
>                        ("irc" :follow org-irc-visit :store
> org-irc-store-link :export
>                         org-irc-export)
>                        ("info" :follow org-info-open :export
> org-info-export :store
>                         org-info-store-link :insert-description
> org-info-description-as-command)
>                        ("gnus" :follow org-gnus-open :store
> org-gnus-store-link)
>                        ("docview" :follow org-docview-open :export
> org-docview-export :store
>                         org-docview-store-link)
>                        ("bibtex" :follow org-bibtex-open :store
> org-bibtex-store-link)
>                        ("bbdb" :follow org-bbdb-open :export
> org-bbdb-export :complete
>                         org-bbdb-complete-link :store org-bbdb-store-link)
>                        ("w3m" :store org-w3m-store-link)
>                        ("doi" :follow org-link-doi-open :export
> org-link-doi-export)
>                        ("attachment" :follow org-attach-follow :complete
>                         org-attach-complete-link)
>                        ("id" :follow org-id-open :store
> org-id-store-link-maybe) ("file+sys")
>                        ("file+emacs") ("shell" :follow
> org-link--open-shell)
>                        ("news" :follow
>                         #[514 "\301\300\302Q\"\207" ["news" browse-url
> ":"] 6
>                           "\n\n(fn URL ARG)"]
>                         )
>                        ("mailto" :follow
>                         #[514 "\301\300\302Q\"\207" ["mailto" browse-url
> ":"] 6
>                           "\n\n(fn URL ARG)"]
>                         )
>                        ("https" :follow
>                         #[514 "\301\300\302Q\"\207" ["https" browse-url
> ":"] 6
>                           "\n\n(fn URL ARG)"]
>                         )
>                        ("http" :follow
>                         #[514 "\301\300\302Q\"\207" ["http" browse-url
> ":"] 6
>                           "\n\n(fn URL ARG)"]
>                         )
>                        ("ftp" :follow
>                         #[514 "\301\300\302Q\"\207" ["ftp" browse-url ":"]
> 6
>                           "\n\n(fn URL ARG)"]
>                         )
>                        ("help" :follow org-link--open-help :store
> org-link--store-help)
>                        ("file" :complete org-link-complete-file)
>                        ("elisp" :follow org-link--open-elisp))
>  org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
> org-babel-header-arg-expand)
>  org-agenda-before-write-hook '(org-agenda-add-entry-text)
>  org-metadown-hook '(org-babel-pop-to-session-maybe)
>  org-repeat-weekdays-mode t
>  org-agenda-restore-windows-after-quit t
>  org-tab-before-tab-emulation-hook '(org-tempo-complete-tag)
>  org-tab-first-hook '(org-babel-hide-result-toggle-maybe
> org-babel-header-arg-expand)
>  org-sort-function 'string-collate-lessp
>  org-export-backends '(pandoc org odt html ascii)
>  org--warnings nil
>  org-babel-pre-tangle-hook '(save-buffer)
>  org-agenda-prefix-format '((agenda . " %?i %-12:c%?-12t% s")
>                             (todo .
>                              " %i %1c %(my-org-format-scheduled-time)
> %(my-org-agenda-format-repeater-hours-frob) %5(my-org-agenda-repeat-hours)
> ")
>                             (tags . " %i %-12:c") (search . " %i %-12:c"))
>  org-export-before-parsing-hook '(org-attach-expand-links)
>  org-pandoc-menu-entry '((101 "to epub3" org-pandoc-export-to-epub3)
>                          (111 "to odt" org-pandoc-export-to-odt))
>  org-link-shell-confirm-function 'yes-or-no-p
>  org-fold-core-isearch-open-function 'org-fold-core--isearch-reveal
>  org-pandoc-options-for-epub3 '((reference-location . "block") (toc-depth
> . "5")
>                                 (epub-chapter-level . "5")
>                                 (data-dir . "/home/toomas/Asjad/org-epub"))
>  outline-isearch-open-invisible-function 'outline-isearch-open-invisible
>  org-src-mode-hook '(org-src-babel-configure-edit-buffer
> org-src-mode-configure-edit-buffer)
>  org-agenda-loop-over-headlines-in-active-region nil
>  org-priority-lowest 90
>  org-preview-latex-default-process 'dvisvgm
>  org-agenda-files '("~/Asjad/org/-.org" "~/Asjad/org/i.org" "~/Asjad/org/
> j.org"
>                     "~/Asjad/org/olme.org" "~/Asjad/org/lipupäevad.org
> <http://xn--lipupevad-z2a.org>"
>                     "~/Asjad/org/projektid.org")
>  org-yank-folded-subtrees nil
>  org-link-elisp-confirm-function 'yes-or-no-p
>  org-odt-format-inlinetask-function
> 'org-odt-format-inlinetask-default-function
>  org-cycle-hook '(org-cycle-hide-archived-subtrees
> org-cycle-show-empty-lines
>                   org-cycle-optimize-window-after-visibility-change
>                   org-cycle-display-inline-images)
>  org-persist-before-read-hook '(org-element--cache-persist-before-read)
>  org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
>  org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
>  org-agenda-sorting-strategy '((todo priority-down user-defined-up))
>  )
>
>

-- 
+---------------------------------------------------------------+
| Derek Chen-Becker                                             |
| GPG Key available at https://keybase.io/dchenbecker and       |
| https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org |
| Fngrprnt: EB8A 6480 F0A3 C8EB C1E7  7F42 AFC5 AFEE 96E4 6ACC  |
+---------------------------------------------------------------+

Reply via email to