Skip to content

Stop thumbnail helpers when their images are discarded - #117

Open
k-kostin wants to merge 2 commits into
omacom:mainfrom
k-kostin:codex/cancel-thumbnail-requests
Open

k-kostin wants to merge 2 commits into
omacom:mainfrom
k-kostin:codex/cancel-thumbnail-requests

Conversation

@k-kostin

@k-kostin k-kostin commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Pass discarded image requests' cancellation flags to main's existing thumbnailer and pdftoppm processes. Wait in 100 ms slices within the existing 15-second deadline, kill the helper when cancelled, and avoid recording a thumbnail or failure marker for cancelled helper work. Sharp-preview fallbacks pass the same flag.

discard Image → cancellation flag → stop helper → serve next image

Reworked independently on main 7c058ce, without #67's process sessions, Ran or shutdown machinery. No new dependency or renderer.

Evidence

  • Before: the retained thumbnailsStopWorkWhenItsImagesGoAway regression fails on main: the follow-up image waits about 2.5 seconds, beyond its 1-second deadline.
    After: the same real QML/provider regression passes and checks both thumbnail and failure caches after the workers drain. It also passes with slow in TMPDIR.
  • Final Release build and full bin/test: 233 passed, 0 failed, 1 skipped (the root-drive trash test needs a writable /). Local Qt 6.12, English locale, offscreen/private session bus, image plugins limited to the package dependencies; not a container-CI claim.
  • Initial runs exposed the host's additional KDE RAW plugin mismatch (reproduced on main), a test-environment QML-path setup error, and an intermittent existing theme-watcher assertion. The corrected final full run passed; the theme-only main control also passed. Logs retained locally.
  • Independent Astra reviews found no blockers; git diff --check passes. Three files, one retained QML regression.

Merge Danger

Door: two-way; reverting restores the original waits, with no cache migration.

Blast Radius: external thumbnail helpers. This stops the direct QProcess; process-session/descendant cleanup remains outside this patch. In-process decoding is not interrupted.

@dhh

dhh commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Thanks, Kirill. Stopping a helper once nobody wants its picture is worth having. But this is stacked on #67's helper machinery (run(), Ran, the kept sessions, m_quitting), and none of that is on main: main's thumbnailers and pdftoppm still run under a plain waitForFinished(15000). The rows-thumbnail part of #67 landed separately in #149, and #67 itself is still open, so this can't be reviewed against what will actually ship.

To make it mergeable, please rebase it onto main on its own, without #67. On main the change can be small: wait for the helper in short slices, kill it when the response's m_cancelled is set, and don't write a failure marker for a cancelled run. Keep one test that fails without the change, such as thumbnailsStopWorkWhenItsImagesGoAway. Then mark it ready. If #67 lands first, rebasing onto that works just as well.

@k-kostin
k-kostin force-pushed the codex/cancel-thumbnail-requests branch from 8f833ec to 84ad9fe Compare November 18, 2026 14:57
@k-kostin
k-kostin changed the base branch from thumbnail-rows to main November 18, 2026 14:58
@k-kostin
k-kostin marked this pull request as ready for review November 18, 2026 14:58
@k-kostin

Copy link
Copy Markdown
Contributor Author

Thanks for the clear direction. Reworked this independently on main 7c058ce in 84ad9fe, without #67's helper/session machinery. Both existing helper paths now use short cancellable waits, and cancelled runs leave no thumbnail or failure marker. The sharp-preview fallback carries the same flag.

Kept one QML regression, thumbnailsStopWorkWhenItsImagesGoAway: it fails on main and passes with this change. The final local full suite reports 233 passed, 0 failed and one permissions-dependent skip with the package image-plugin set. Release build and independent reviews passed. The PR now targets main and is ready for review.

@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Discarded image requests now stop their external thumbnail helpers so workers can serve newer images sooner.

  • Discarded images stop holding thumbnail workers on slow helpers.

No actionable issues found.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Image discarded] --> B[Cancellation flag set]
  B --> C[Helper wait notices cancellation]
  C --> D[Kill direct helper process]
  D --> E[Skip cache writes]
  E --> F[Worker serves next image]
Loading

Reviews (2) · Last reviewed commit: "Match slow test helpers by filename" · Reviewed by Greptile

@dhh
dhh force-pushed the codex/cancel-thumbnail-requests branch from 84ad9fe to 0d0e0f0 Compare November 18, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants