DockerビルドのOOM(exit 137)をrelease codegen-units=1で回避#1537
Conversation
jpreprocessのnaist-jdic辞書(約77MB)がinclude_bytes!でバイナリに埋め込まれ、 release既定のcodegen-units=16では大容量定数を含むモジュールと他ユニットが並列 展開されピークメモリが急増する。メモリ制約のあるself-hostedデプロイランナーで OOMするため、Dockerビルド時のみcodegen-units=1にして並列度を落とす。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 3 hours, 30 minutes, and 39 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
概要
ステージング/本番デプロイの Docker ビルドが
cargo build -p stationapi --releaseの段階で OOM(exit 137)し失敗していたのを修正します。原因は #1534 で追加した jpreprocess のnaist-jdic辞書(約77MB)がinclude_bytes!でバイナリに埋め込まれ、release 既定のcodegen-units = 16だと大容量定数を含むモジュールと他ユニットが並列展開されてピークメモリが急増し、メモリ制約のある self-hosted ランナーで OOM するためです。変更の種類
変更内容
docker/api/DockerfileのビルダーステージにENV CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1を追加。最終クレートのコード生成を直列化し、77MB 定数を含むモジュールが他ユニットと同時展開されないようにしてピークメモリを抑える(ビルドは遅くなるが安定する)。テスト
cargo fmt --all -- --checkが通ることcargo clippy -- -D warningsが通ることcargo test(SQLX_OFFLINE=true)が通ること省略: Rust コード・データの変更なし(
docker/api/Dockerfileのビルド設定のみ)。アプリ本体は #1534 / PR #1535 で検証済み。デプロイ Docker ビルドの成否はマージ後の staging デプロイで確認します。関連Issue
スクリーンショット(任意)