Chunked secrets storage leaks a goroutine on every failed release decode
評估
研究方向
從pkg/storage/chunked.go中的chunkedSecrets.decodeRelease開始,追蹤 gzip 或 JSON 解碼失敗時如何處理io.Pipe的 reader 和 writer。使用步驟中描述的無效 chunk 資料重現問題,接著確認重複失敗的Get呼叫不再增加 goroutine 數量,且仍會傳回預期的 gzip 錯誤。
由索引模型根據 Issue 內容生成。
描述
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.
- 主要語言
- Go
- 星號
- 59
- 分支
- 54
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
operator-framework/helm-operator-plugins 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
-
難度 4/5 3-5 天 新手友好度 54/100
-
Update to Helm 4未關閉
難度 4/5 3-5 天 新手友好度 35/100
-
難度 4/5 3-5 天 新手友好度 35/100
-
難度 3/5 1-2 天 新手友好度 42/100
查看 operator-framework/helm-operator-plugins 的全部 Issue
相似的 Issue
-
enhancement
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 70/100
-
難度 2/5 1-3 小時 新手友好度 65/100
Azure/azure-storage-azcopy#3681 ·
維護者通常 2 天內回覆
-
Case detail: main-column section headers are hard to distinguish from body text可能已有人在做 @yubessy 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 68/100
ubie-oss/hecatoncheires#347 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 66/100
meilisearch/meilisearch-go#829 ·