sandbox/storage: stale team-index SET entries accumulate when sandbox keys are lost without going through Remove()
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia in items.go, su ExpiredItems, e segui come vengono rimossi i membri orfani dell'indice di scadenza e come vengono formate le chiavi dell'indice del team. Verifica i test esistenti di sandbox/storage e aggiungi la copertura per una chiave sandbox assente; il lavoro è completato quando la pulizia degli elementi orfani rimuove sia il membro di scadenza globale sia la relativa voce nell'indice del team, senza influire sui sandbox attivi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The per-team sandbox index (sandbox:storage:{teamID}:index, a Redis SET) accumulates stale entries that are never cleaned up when sandbox keys disappear outside the normal Remove() path.
Root cause
ExpiredItems() sweeps orphaned ZSET members (entries in sandbox:storage:global:expiration whose corresponding sandbox key is gone), but only removes the ZSET member — it does not remove the sandboxID from the team index SET:
// items.go — current behaviour
if raw == nil {
staleMembers = append(staleMembers, ref.member) // ZREM the ZSET member ✓
orphanCount++
continue // team index entry is NOT cleaned ✗
}
No other code path cleans the team index for absent sandbox keys:
TeamItems/fetchSandboxBatchsilently skipnilMGET results with acontinue- The healer (
healExpirationIndex) only fills missing ZSET members, never prunes the team index Remove()/removeSandboxScriptcleans both atomically, but only runs on the normal removal path
The team index SET therefore grows without bound whenever sandbox keys disappear externally — most commonly via Redis maxmemory key eviction or a Redis restart with incomplete persistence.
Observed impact
Teams with high sandbox churn (frequent create / pause / resume cycles) combined with Redis key eviction can accumulate thousands of stale SET members, inflating Redis memory and slowing TeamItems (SMEMBERS + MGET fan-out is proportional to SET size, including stale entries).
Trigger conditions
- Redis
maxmemorypolicy that can evict individual sandbox keys (allkeys-lru,allkeys-random, etc.) - Redis restart with RDB/AOF disabled or incomplete
- Any path that deletes a sandbox key without calling
sandboxStore.Remove()
Frequent autoPause / autoResume amplifies the issue by increasing per-team sandbox churn and Redis memory pressure, raising the probability of key eviction.
Fix
When ExpiredItems finds an orphaned ZSET member (MGET returned nil), also SREM the sandboxID from the team index. MGET already confirmed the sandbox key is absent, so we cannot unindex a live sandbox. A concurrent Add that races the SREM will SADD the sandboxID back immediately, so the worst outcome is a brief gap in TeamItems results for one eviction cycle.
- Lingua principale
- Go
- Stelle
- 1.6k
- Fork
- 438
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
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 e2b-dev/runtime
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
sandbox cache: StartRemoving state transition not broadcast, all allocations see stale Running stateAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di e2b-dev/runtime
Issue simili
-
security
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
cvss-severity:high devguard l3montree-cybersecurity/...ard-k8s-image-inventory pkg:oci/devguard-k8s-ima...ch=amd64&tag=main-amd64 pkg:oci/devguard-k8s-ima...ch=arm64&tag=main-arm64 risk:low state:open
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
l3montree-dev/devguard#3094 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
JuliusBrussee/caveman#1127 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement low priority
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
eugenioenko/ttt#674 ·
I maintainer di solito rispondono entro 1 giorno
-
kind/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
gpustack/gpustack-operator#640 ·
I maintainer di solito rispondono entro 1 giorno