Skip to content

fix: cpu-ram-crash#61

Merged
RambokDev merged 3 commits into
mainfrom
fix/cpu-ram-crash
Jun 7, 2026
Merged

fix: cpu-ram-crash#61
RambokDev merged 3 commits into
mainfrom
fix/cpu-ram-crash

Conversation

@RambokDev

@RambokDev RambokDev commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Performance & Stability
    • Explicit container resource limits (CPU allocation, memory caps, and process limits) are now applied to ensure consistent application behavior and prevent resource exhaustion.
    • Database restore operations for MySQL and MariaDB have been optimized with direct streaming, significantly reducing memory consumption and improving efficiency during restoration.

charles-gauthereau and others added 3 commits June 7, 2026 19:15
Eliminates OOM crash when restoring databases larger than ~2 GB.
std::io::copy uses a 64 KB buffer regardless of file size.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Same OOM fix applied to MySQL restore. std::io::copy streams with a
64 KB buffer, keeping heap flat for arbitrarily large SQL dumps.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 603b02a4-1db5-4056-b94d-42150b84d6ae

📥 Commits

Reviewing files that changed from the base of the PR and between 185a7ee and 7b1eeed.

📒 Files selected for processing (3)
  • docker-compose.yml
  • src/domain/mariadb/restore.rs
  • src/domain/mysql/restore.rs

📝 Walkthrough

Walkthrough

The pull request adds resource constraints to the containerized Rust application and optimizes database restore operations. MariaDB and MySQL restore procedures now stream SQL files directly into their respective processes instead of buffering entire files in memory, reducing memory overhead during restoration.

Changes

Database Restore Streaming Optimization

Layer / File(s) Summary
MariaDB restore streaming
src/domain/mariadb/restore.rs
Imports are updated to support file streaming; restore file open now includes contextual error handling; the SQL content is streamed directly to MariaDB stdin using std::io::copy instead of writing an in-memory buffer.
MySQL restore streaming
src/domain/mysql/restore.rs
Imports are updated to remove generic Read/Write traits; restore file open includes contextual error handling; the SQL content is streamed directly to MySQL stdin using std::io::copy instead of writing an in-memory buffer.

Container Resource Limits

Layer / File(s) Summary
Docker Compose resource limits
docker-compose.yml
The rust-app service is configured with explicit resource constraints: CPU quota, memory and swap limits, and maximum process count.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A rabbit hops through memory lanes,
Streaming files like flowing rains,
No buffers bloat, just stdin flows fast,
While Docker walls keep resources vast!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cpu-ram-crash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@RambokDev RambokDev merged commit 1453851 into main Jun 7, 2026
1 of 2 checks passed
@RambokDev RambokDev deleted the fix/cpu-ram-crash branch June 7, 2026 18:04
@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

1 participant