bug: S3Uploader loads entire file into RAM via file_get_contents #73

Closed
opened 2026-06-21 23:01:03 +00:00 by jmiller · 0 comments
Owner

Severity: CRITICAL

S3Uploader::singleUpload() uses file_get_contents($localPath) on files up to 100 MB, loading the entire backup archive into a PHP string. Combined with existing memory usage from the backup process, this reliably causes OOM on medium-to-large sites.

Fix

Use CURLOPT_UPLOAD => true with CURLOPT_INFILE and CURLOPT_INFILESIZE to stream the file to S3.

File

  • src/Engine/S3Uploader.php:118-131
## Severity: CRITICAL `S3Uploader::singleUpload()` uses `file_get_contents($localPath)` on files up to 100 MB, loading the entire backup archive into a PHP string. Combined with existing memory usage from the backup process, this reliably causes OOM on medium-to-large sites. ## Fix Use `CURLOPT_UPLOAD => true` with `CURLOPT_INFILE` and `CURLOPT_INFILESIZE` to stream the file to S3. ## File - `src/Engine/S3Uploader.php:118-131`
jmiller added the component: enginecomponent: remote labels 2026-06-21 23:01:03 +00:00
Sign in to join this conversation.
Priority Medium
Type Feature
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoSuiteBackup#73