Asset requests can fail with AssetNotFoundException after restart or stale client state

Aperta
#638 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp, docker
Ambito
api, backend

Direzione di ricerca

Start at BloomFilterAssetAccountTracker.ForAsset, which throws AssetNotFoundException, then trace the calls up through TotalAccountImagesSelectionStrategy.ForAsset, MultiImmichFrameLogicDelegate.GetAsset and AssetController.GetAsset. Decide whether the fix is a durable account lookup or a graceful failure, since the issue lists both without choosing. Done means a stale asset ID after restart no longer produces an unhandled exception, and no repro test exists yet, so one must be written first.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Version

1.0.32.x / current main branch behavior

Deployment Method

Docker container

Description

I hit an unhandled exception during smoke testing when requesting an asset that had previously been listed by the server.

The failing path is:

  • AssetController.GetAsset(...)
  • MultiImmichFrameLogicDelegate.GetAsset(...)
  • TotalAccountImagesSelectionStrategy.ForAsset(...)
  • BloomFilterAssetAccountTracker.ForAsset(...)

BloomFilterAssetAccountTracker throws AssetNotFoundException when it cannot map the requested asset ID back to an account.

This appears to depend on in-memory tracker state rather than on whether the asset actually exists in Immich. A likely trigger is:

  • client holds an older asset ID list,
  • server restarts / tracker state is lost,
  • client requests /api/Asset/{id}/Asset,
  • lookup fails because the asset was never re-recorded in the current process.

So the request can fail even though the asset still exists upstream.

Reproduction

I do not have a minimal deterministic repro yet, but the observed flow was:

  1. Start the server and client normally.
  2. Load assets.
  3. Restart the server or otherwise end up with stale client-side asset references.
  4. Request an asset by ID from the client.
  5. Server throws ImmichFrame.Core.Exceptions.AssetNotFoundException from BloomFilterAssetAccountTracker.ForAsset.
Expectations

Asset retrieval should not depend solely on transient in-memory tracker state.

A request for an existing asset should either:

  • resolve the correct account by a durable lookup path, or
  • fail gracefully without an unhandled exception.
Logs
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "...", Request id "...": An unhandled exception was thrown by the application.
ImmichFrame.Core.Exceptions.AssetNotFoundException: Exception of type 'ImmichFrame.Core.Exceptions.AssetNotFoundException' was thrown.
   at ImmichFrame.Core.Logic.AccountSelection.BloomFilterAssetAccountTracker.ForAsset[T](String assetId, Func`2 f)
   at ImmichFrame.Core.Logic.AccountSelection.TotalAccountImagesSelectionStrategy.ForAsset[T](Guid assetId, Func`2 f)
   at ImmichFrame.Core.Logic.MultiImmichFrameLogicDelegate.GetAsset(Guid assetId, Nullable`1 assetType, String rangeHeader)
   at ImmichFrame.WebApi.Controllers.AssetController.GetAsset(Guid id, String clientIdentifier, Nullable`1 assetType)
Additional Notes

I checked for duplicates and found other generic "frontend stops at error" / "unhandled exception" issues, but not one for this specific BloomFilterAssetAccountTracker lookup failure.

Lingua principale
C#
Stelle
2.4k
Fork
121
Merge medio
18g 20h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di immichFrame/ImmichFrame

Tutte le issue di immichFrame/ImmichFrame

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.