• Steven's avatar
    fix(server): prevent memory exhaustion in thumbnail generation · 8f29db2f
    Steven authored
    Address high memory usage when opening resource tab (fixes #5183) by implementing:
    
    1. Concurrency control: Limit thumbnail generation to 3 concurrent operations using semaphore to prevent memory exhaustion when many images are requested simultaneously
    
    2. S3 optimization: Skip server-side thumbnail generation for S3-stored images by default. S3 images now use presigned URLs directly, avoiding:
       - Downloading large images from S3 into server memory
       - Decoding and resizing images on the server
       - High memory consumption during batch requests
    
    3. Memory management improvements:
       - Explicitly clear blob and decoded image from memory after use
       - Restructure thumbnail cache check to avoid unnecessary semaphore acquisition
       - Double-check pattern to prevent duplicate generation while waiting
    
    This restores the original S3 behavior before commit e4f63453 while maintaining thumbnail support for local/database storage.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    Co-Authored-By: 's avatarClaude <noreply@anthropic.com>
    8f29db2f
Name
Last commit
Last update
.github Loading commit data...
cmd/memos Loading commit data...
internal Loading commit data...
plugin Loading commit data...
proto Loading commit data...
scripts Loading commit data...
server Loading commit data...
store Loading commit data...
web Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
.golangci.yaml Loading commit data...
.goreleaser.yaml Loading commit data...
CLAUDE.md Loading commit data...
CODEOWNERS Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
SECURITY.md Loading commit data...
go.mod Loading commit data...
go.sum Loading commit data...