Skip to content

DockerビルドのOOM(exit 137)をrelease codegen-units=1で回避#1537

Merged
TinyKitten merged 1 commit into
devfrom
fix/docker-build-oom
Jun 16, 2026
Merged

DockerビルドのOOM(exit 137)をrelease codegen-units=1で回避#1537
TinyKitten merged 1 commit into
devfrom
fix/docker-build-oom

Conversation

@TinyKitten

Copy link
Copy Markdown
Member

概要

ステージング/本番デプロイの Docker ビルドが cargo build -p stationapi --release の段階で OOM(exit 137)し失敗していたのを修正します。原因は #1534 で追加した jpreprocess の naist-jdic 辞書(約77MB)が include_bytes! でバイナリに埋め込まれ、release 既定の codegen-units = 16 だと大容量定数を含むモジュールと他ユニットが並列展開されてピークメモリが急増し、メモリ制約のある self-hosted ランナーで OOM するためです。

変更の種類

  • バグ修正
  • 新機能
  • データの修正・追加
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • docker/api/Dockerfile のビルダーステージに ENV CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 を追加。最終クレートのコード生成を直列化し、77MB 定数を含むモジュールが他ユニットと同時展開されないようにしてピークメモリを抑える(ビルドは遅くなるが安定する)。
  • アプリのコード・依存・データは変更なし。生成されるバイナリの内容・挙動は同一(最適化単位の分割のみが変わる)。

テスト

  • cargo fmt --all -- --check が通ること
  • cargo clippy -- -D warnings が通ること
  • cargo testSQLX_OFFLINE=true)が通ること

省略: Rust コード・データの変更なし(docker/api/Dockerfile のビルド設定のみ)。アプリ本体は #1534 / PR #1535 で検証済み。デプロイ Docker ビルドの成否はマージ後の staging デプロイで確認します。

関連Issue

スクリーンショット(任意)

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>
@TinyKitten TinyKitten self-assigned this Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@TinyKitten, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66f864e8-1bb7-4679-bb9a-ce905c3d4880

📥 Commits

Reviewing files that changed from the base of the PR and between 8e11da6 and ee6f1a9.

📒 Files selected for processing (1)
  • docker/api/Dockerfile
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/docker-build-oom

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

@TinyKitten TinyKitten merged commit 3408d00 into dev Jun 16, 2026
3 checks passed
@TinyKitten TinyKitten deleted the fix/docker-build-oom branch June 16, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant