[Bug]: Project favicon lookup probes ~30 paths one at a time, so a slow disk stalls assets.createUrl for a minute

Aperta Adatta ai principianti
#12,542 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript

Direzione di ricerca

Inizia da apps/server e segui assets.createUrl fino a ProjectFaviconResolver.resolvePathUncached, quindi esamina come vengono verificati e prioritizzati i 21 percorsi noti e i 7 file sorgente. Riproduci il caso del filesystem lento, se possibile; il lavoro è completato quando una ricerca a freddo verifica i candidati in concorrenza, mantiene l’ordine di priorità ed evita il ritardo sequenziale segnalato.

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

Descrizione

Area

apps/server

Steps to reproduce
  1. Run the server on a host where filesystem calls are slow (in my case a WSL2 host under heavy memory and I/O pressure, where one stat took 1 to 4 seconds).
  2. Open a client so that it requests project favicon asset URLs (assets.createUrl).
Expected behavior

A favicon lookup costs about one filesystem round trip, because the probes do not depend on each other.

Actual behavior

ProjectFaviconResolver.resolvePathUncached probes 21 well-known paths and then 7 source files one after the other. A miss costs about 30 sequential filesystem calls, so the request time is 30 times the latency of one call. The cache added in #9080 does not help a cold lookup, and a miss stays cached for only 1 minute.

Numbers from server.trace.ndjson during the slow period:

Span Count Median Max
ws.rpc.assets.createUrl 72 38.6 s 79.4 s

One slow call, by child span:

ws.rpc.assets.createUrl                          77697 ms
  AssetAccess.issueAssetUrl                      77648 ms
    WorkspacePaths.normalizeWorkspaceRoot         1241 ms
    ProjectFaviconResolver.resolvePath           60149 ms
      ProjectFaviconResolver.resolvePathUncached 60140 ms
        findExistingFile  1942 ms
        findExistingFile  1781 ms
        findExistingFile  2274 ms
        findExistingFile  4420 ms
        ... (one span for each candidate, in sequence)
    ServerSecretStore.getOrCreateRandom           1435 ms
Impact

On a slow disk or a loaded host, project icons and every other assets.createUrl call for a project favicon wait for a minute or more. The host was the root cause of the slowness in my case, but the sequential walk multiplied it by 30.

Version or commit

0.0.43-nightly.20260918.1895. The code is the same on main at 0f1b572b9.

Environment

Linux (WSL2), server run as a service.

Workaround

None. A proposed fix probes the candidates concurrently and keeps the priority order.

Lingua principale
TypeScript
Stelle
23.2k
Fork
5.9k
Merge medio
10h 57m
PR unite (30g)
365

Guida per i contributori

Apri la guida per i contributori

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 pingdotgg/t3code

Tutte le issue di pingdotgg/t3code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.