ResourceManager: reference-count consumers of shared in-flight asset loads
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- typescript
- Ambito
- backend, performance
Direzione di ricerca
Start with ResourceManager.load(), _loadingPromises, and cancelNotLoaded() to trace how shared AssetPromise instances are created and canceled. Then inspect the GLB sub-asset loading path and existing cancellation tests. Add coverage for first- and later-caller cancellation, shared GLB dependencies, and cleanup after resolve, reject, and cancel; done means one consumer can release without disrupting others, and the shared load cancels only after its final consumer releases it.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Background
ResourceManager deduplicates concurrent asset loads by storing one shared AssetPromise per resolved loading key in _loadingPromises.
This was noticed while reviewing #3084, but the cancellation behavior predates that PR. #3084 only makes virtual, relative, and physical URLs resolve consistently to the same loading key.
Problem
The first caller receives the shared loader promise directly, while subsequent callers receive forwarding promises. This makes cancellation depend on caller order:
const promiseA = resourceManager.load(url);
const promiseB = resourceManager.load(url);
promiseA.cancel();
Because promiseA is also the promise stored in _loadingPromises, canceling it rejects both callers. In contrast, canceling promiseB only cancels its forwarding promise and leaves the shared load running.
cancelNotLoaded(url) also cancels the shared promise for that key, so every pending consumer is rejected. There is currently no consumer ownership or reference count.
The same ownership model matters for GLB sub-assets:
const materialA = resourceManager.load("model.glb?q=materials[0]");
const materialB = resourceManager.load("model.glb?q=materials[1]");
Both sub-assets depend on the same main GLB load. Releasing one consumer should not cancel the main load while another consumer still depends on it.
Proposed direction
Store a loading entry instead of only a promise:
interface LoadingEntry<T> {
promise: AssetPromise<T>;
refCount: number;
}
- Keep the shared loader promise internal.
- Return an independent consumer promise/handle from every
load()call, including the first. - Increment the reference count when a consumer joins an in-flight load.
- Decrement it exactly once when that consumer cancels.
- Cancel the shared load only when the last consumer releases it.
- Track sub-asset dependencies so a main GLB load remains alive while any requested sub-asset still needs it.
- Define
cancelNotLoaded(url)explicitly as either a force-cancel API or a single-reference release; keeping it as force-cancel would preserve its current resource-manager-level semantics.
Acceptance criteria
- Canceling either of two callers loading the same URL does not reject the other caller.
- The underlying shared promise is canceled only after the last active consumer cancels.
- Canceling one GLB sub-asset consumer does not affect another sub-asset consumer.
- Entries and reference counts are cleaned up after resolve, reject, and cancel.
- Tests cover cancellation initiated by both the first and later callers.
- Lingua principale
- TypeScript
- Stelle
- 5.9k
- Fork
- 413
- Merge medio
- 16h 17m
- PR unite (30g)
- 41
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di galacean/engine
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
I maintainer di solito rispondono entro 1 giorno
-
RFC: Adopt Unity-style Collider components and hierarchical Rigidbody ownershipForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
I maintainer di solito rispondono entro 1 giorno
-
SkinnedMeshRenderer should derive default rootBone-space localBounds from mesh and skinForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di galacean/engine
Issue simili
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
elastic/kibana#306401 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
agentes-chat/agentes-chat#927 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Webapp workspace fails to render in Safari — "Can't find variable: requestIdleCallback"Apertacomp/desktop P2 type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NousResearch/hermes-agent#157702 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
e2e-failure ready-to-code
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
redhat-developer/rhdh-plugin-export-overlays#4794 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno