Skip to content

fix: add file size limits to prevent plugin OOM crashes#2

Open
hjpinheiro wants to merge 1 commit into
daytona:mainfrom
hjpinheiro:fix/file-size-limits
Open

fix: add file size limits to prevent plugin OOM crashes#2
hjpinheiro wants to merge 1 commit into
daytona:mainfrom
hjpinheiro:fix/file-size-limits

Conversation

@hjpinheiro

Copy link
Copy Markdown

Summary

The upload_file and download_file tools have no file size checks. A large file (multi-GB dataset, log file, etc.) can exhaust the plugin daemon memory and crash the entire plugin process.

Changes

  • _client.py: Add MAX_FILE_SIZE = 100 MB shared constant
  • tools/upload_file.py: Check file.blob size before uploading
  • tools/download_file.py: Check file metadata size via get_file_info() before downloading (avoids downloading the file at all), with a post-download size check as a safety net

Behavior

Scenario Before After
Upload 5GB file OOM crash ValueError with clear message
Download 5GB file OOM crash ValueError before transfer starts

The 100 MB limit is a safe default for a plugin daemon with 256 MB memory (resource.memory: 268435456 in manifest.yaml).

Without size checks, uploading or downloading large files (e.g. multi-GB
datasets) can exhaust the plugin daemon memory and crash the entire
plugin process.

- Add MAX_FILE_SIZE (100 MB) constant in _client.py
- upload_file: check blob size before uploading
- download_file: check file info size before downloading, and verify
  downloaded content size as a safety net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants