bug: DatabaseDumper loads entire SQL dump into RAM — OOM on large sites #74

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

Severity: CRITICAL

DatabaseDumper::dump() returns the entire SQL dump as a single string. BackupEngine::run() then passes it to $archiver->addFromString(). A 500 MB database allocates the dump 2-3x in RAM (array + implode + ZipArchive buffer), exceeding the 512 MB memory limit.

SteppedBackupEngine already writes to a temp file incrementally — the synchronous engine should do the same.

Fix

Write the dump to a temp .sql file and use $archiver->addFile() instead of addFromString().

Files

  • src/Engine/BackupEngine.php:136-138
  • src/Engine/DatabaseDumper.php — add streaming/file-based dump method
## Severity: CRITICAL `DatabaseDumper::dump()` returns the entire SQL dump as a single string. `BackupEngine::run()` then passes it to `$archiver->addFromString()`. A 500 MB database allocates the dump 2-3x in RAM (array + implode + ZipArchive buffer), exceeding the 512 MB memory limit. `SteppedBackupEngine` already writes to a temp file incrementally — the synchronous engine should do the same. ## Fix Write the dump to a temp `.sql` file and use `$archiver->addFile()` instead of `addFromString()`. ## Files - `src/Engine/BackupEngine.php:136-138` - `src/Engine/DatabaseDumper.php` — add streaming/file-based dump method
jmiller added the component: engine label 2026-06-21 23:01:08 +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#74