Chunked secrets storage leaks a goroutine on every failed release decode
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia in pkg/storage/chunked.go, in corrispondenza di chunkedSecrets.decodeRelease, e segui come vengono gestiti il lettore e lo scrittore di io.Pipe quando la decodifica gzip o JSON non riesce. Riproduci il problema con i dati chunk non validi descritti nei passaggi, quindi verifica che le chiamate ripetute a Get che falliscono non aumentino più il numero di goroutine e continuino a restituire l’errore gzip previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
chunkedSecrets.decodeRelease in pkg/storage/chunked.go starts a goroutine that writes the chunk data into an io.Pipe, and it reads the other end with gzip.NewReader and json.Decoder. The read side of the pipe is never closed. When decoding returns an error before all of the data has been read, the writer goroutine blocks on pw.Write forever and holds a reference to the secret data.
The leak happens whenever decoding fails before the writer finishes, for example because the gzip header is invalid or the JSON payload can't be decoded due to a corrupt or truncated chunk. Each failed Get, List, or Query leaks one goroutine, so an operator that keeps reconciling an affected release leaks a goroutine on every attempt.
Steps to reproduce
-
Create an index secret with invalid chunk data that is larger than the gzip reader's buffer:
sec := &corev1.Secret{ ObjectMeta: metav1.ObjectMeta{Name: "bad.v1"}, Type: storage.SecretTypeChunkedIndex, Data: map[string][]byte{ "extraChunks": []byte("[]"), "chunk": make([]byte, 10000), }, } -
Call
Get("bad.v1")on a driver created withstorage.NewChunkedSecrets20 times. -
Compare
runtime.NumGoroutine()before and after.
Expected behavior
Each call returns failed to create gzip reader: gzip: invalid header, and the goroutine count stays the same.
Actual behavior
Each call returns the error, but the goroutine count goes up by one for every call (13 before, 33 after 20 calls). The leaked goroutines are blocked in (*chunkedSecrets).decodeRelease.func1 on pw.Write.
Successful decodes don't leak.
- Lingua principale
- Go
- Stelle
- 59
- Fork
- 54
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun 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 operator-framework/helm-operator-plugins
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 54/100
-
Update to Helm 4Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
Tutte le issue di operator-framework/helm-operator-plugins
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
Azure/azure-storage-azcopy#3681 ·
I maintainer di solito rispondono entro 2 giorni
-
Case detail: main-column section headers are hard to distinguish from body textForse già presa @yubessy l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ubie-oss/hecatoncheires#347 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
meilisearch/meilisearch-go#829 ·