Skip to content

Background preparation stops building previews and doesn't resume, though many photos still have none #3947

Open

Description

@SamLovick

Version / system

  • LightCraft 0.19.0, Windows 11 Pro for Workstations, AMD Radeon RX 6900 XT (Dx12)
  • Library: 74,388 photos, originals on a local drive
  • Background Preparation settings (app-wide, prefs.backgroundPrep): Library and Culling previews: true, scope: all, ahead: 5; Develop ahead: 2, scope: all

What happened

  1. "Preparing Photos in Background" ran for a while after an import and built roughly 10,000 previews in about an hour. The thumbs folder grew from about 13,000 to about 33,700 files.
  2. It then stopped, and nothing has started it again:
    • Several restarts of the app with the view on All Photos (74,388 photos).
    • Switching Library background previews off and back on (prefs.setBackgroundPrep).
  3. While it's idle, prefs.backgroundPrep reports "building": null and library.previewProgress returns null. No new files appear in thumbs.

Many photos still have no preview

I ran with LIGHTCRAFT_LOG=debug and looked at the render Thumb(...) lines:

  • Newest first (the default sort): all 355 thumbnails shown at startup came from the cache in 2–3 ms.
  • Oldest first, then by file name: 29 of 88 thumbnails had to be rendered on demand, at about 365 ms each. For example 2004\2004-05-08\DSC_0025.NEF and DSC_0026_reference.jpg.

So background preparation thinks it has nothing left to do, while many older photos have no cached preview.

Expected

With scope: all, background preparation should keep going until every photo in view has a preview, or the UI should say why it stopped. A user can't tell whether it finished, stalled or gave up.

Notes

  • The debug log has no line at all from background preparation, so it's impossible to see what it decided. A debug line when it starts, finishes or skips a pass would help.
  • Workaround: library.buildPreviews over All Photos builds them, at about 490 photos a minute. It renders at the larger "standard" size, so it also redoes the smaller previews that background preparation had already made.
  • The activity row is an indeterminate bar with no count. A done/total count would make it obvious when it has stopped.

Activity

  1. ticket-craft commented on Nov 8, 2026

    @ticket-craft

    Thanks! This ticket describes several separate problems:

    • Background preparation stops early and never resumes with scope all
    • No log or done/total progress for background preparation

    It helps a lot if each one has its own ticket, so they can be tracked and fixed separately.

    Possibly related: #3252 and #1492.

  2. SamLovick commented on Nov 8, 2026

    @SamLovick
    Author

    Some findings on the cause:

    Doesn't resume: a background pass only starts from the loupe, after stepping through 3 photos in the same view (prep_tick in crates/engine/src/prep.rs; the app passes no photo while in the grid). Each view is built once, and a sort, filter or import cancels the running pass. So a restart, or switching Library previews off and on in the grid, starts nothing. Should it also start from the grid when the scope is "all"?

    Rebuilt previews: the background build passes no edge, so it builds at max(2048 px, loupe size) (standard_edge in crates/engine/src/cmd/previews.rs). Build Standard-Sized Previews asks for 2560 px, or the chosen limit, before a loupe has been shown (standard_build_params in crates/ui-egui/src/menus/menubar.rs). Its skip check (already_built) treats the 2048 px previews as too small and renders them again. Both should use the same size.

  3. chamber074 commented on Nov 10, 2026

    @chamber074

    Taking this one. Plan: a diagnosis pass first — verify SamLovick's findings against current main, pin down why the original pass stopped with most of the library unbuilt (not just why nothing restarts it), and reconcile the two different "has a preview" decisions (background preparation's vs the grid renderer's) — then the fix as its own PR.

    AI-assisted, same workflow as my other LightCraft work; the drafting sessions for this one run on Claude Fable, with the same gates and diff review before anything ships.

  4. SamLovick commented on Nov 10, 2026

    @SamLovick
    Author

    Thanks for taking this, @chamber074. As ticket-craft suggested, I've split the logging/visibility part into #4082, so this issue covers why background preparation stops and doesn't start again.

    I have a small local fix for the size mismatch from my earlier comment, with a test: background preparation and Build Standard-Sized Previews both use one rule (the chosen limit, else max(2560 px, loupe size)). Happy to share it if it's useful to you, or to drop it if your PR covers that.

    I'm also happy to test your branch on a real library of about 74,000 photos on Windows 11 (RX 6900 XT). Just say when it's ready.

  5. chamber074 commented on Nov 11, 2026

    @chamber074

    Thanks, Sam — and thanks for the split; keeping the logging in #4082 makes sense, so I will leave the debug logging out of this one entirely.

    Your size fix is welcome — please go ahead with it as your own change. My diagnosis lines up with yours on the cause: the pass is bound to one exact ordered id list and prep_tick cancels it the moment that list changes, and there is no record anywhere that a pass was interrupted, so nothing ever restarts one — the grid never reaches the start logic at all. The PR from my side will cover only that stop / never-resumes mechanism: resume an interrupted pass for the view now shown, from the grid as well, once the view settles. I will keep the size rule out of it so the two changes do not collide.

    And yes, please — testing the branch on your ~74,000-photo library would be exactly the check this needs. I will ping you here when it is up.

  6. chamber074 commented on Nov 11, 2026

    @chamber074

    @SamLovick — the branch is up as PR #4093: background preparation now records an unfinished pass in the library's prefs and takes it up again from any screen, grid included, once the view has been still for a few seconds. As agreed on this issue, it contains no logging (that's your #4082) and does not touch the preview size rule — your fix for that is welcome as its own change, and nothing here collides with it.

    Your offer to test on your ~74,000-photo library would be genuinely valuable: that's the scale this was reported at, and my own testing is synthetic libraries and the unit suites. The PR body lists the gates and the judgement calls; anything your library shows up, I'd rather hear about than not.

  7. added a commit that references this issue on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmultiple issuespriority: medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions