Unbounded blob cache during restore can exhaust memory #29

Open
opened 2026-02-08 21:01:10 +01:00 by clawbot · 0 comments
Collaborator

Bug

In internal/vaultik/restore.go, the Restore method uses a blobCache map[string][]byte that grows without bound:

blobCache := make(map[string][]byte)

for i, file := range files {
    if err := v.restoreFile(..., blobCache, result); err != nil {
        ...
    }
}

Each downloaded blob (up to 10GB each per config default) is cached in memory. For large restores with many unique blobs, this can exhaust system memory and crash the process.

Impact

  • Restoring large backups (hundreds of blobs) will OOM the process
  • No way to control memory usage during restore

Fix

Implement an LRU cache with a configurable maximum size, evicting the least recently used blobs when the cache exceeds the limit. A reasonable default would be ~1GB or a small number of blobs.

## Bug In `internal/vaultik/restore.go`, the `Restore` method uses a `blobCache map[string][]byte` that grows without bound: ```go blobCache := make(map[string][]byte) for i, file := range files { if err := v.restoreFile(..., blobCache, result); err != nil { ... } } ``` Each downloaded blob (up to 10GB each per config default) is cached in memory. For large restores with many unique blobs, this can exhaust system memory and crash the process. ## Impact - Restoring large backups (hundreds of blobs) will OOM the process - No way to control memory usage during restore ## Fix Implement an LRU cache with a configurable maximum size, evicting the least recently used blobs when the cache exceeds the limit. A reasonable default would be ~1GB or a small number of blobs.
clawbot self-assigned this 2026-02-08 21:01:10 +01:00
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/vaultik#29
No description provided.