Chunked secrets storage leaks a goroutine on every failed release decode
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza en pkg/storage/chunked.go, en chunkedSecrets.decodeRelease, y sigue cómo se gestionan el lector y el escritor de io.Pipe cuando falla la decodificación gzip o JSON. Reproduce el problema con los datos de chunk no válidos descritos en los pasos y verifica después que las llamadas repetidas y fallidas a Get ya no aumentan el número de goroutines y siguen devolviendo el error gzip esperado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 59
- Forks
- 54
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Sin plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de operator-framework/helm-operator-plugins
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 54/100
-
Update to Helm 4Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
Todos los issues de operator-framework/helm-operator-plugins
Issues similares
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Azure/azure-storage-azcopy#3681 ·
Los mantenedores suelen responder en 2 días
-
Case detail: main-column section headers are hard to distinguish from body textPosiblemente ocupada @yubessy la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ubie-oss/hecatoncheires#347 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
meilisearch/meilisearch-go#829 ·