Skip to content

fix(docker): run images under tini so orphaned prisma node processes are reaped - #49448

Closed
ianalloway wants to merge 1 commit into
BerriAI:mainfrom
ianalloway:fix/docker-tini-init
Closed

ianalloway wants to merge 1 commit into
BerriAI:mainfrom
ianalloway:fix/docker-tini-init

Conversation

@ianalloway

Copy link
Copy Markdown

Relevant issues

Fixes #33414

Supersedes #33599, which targeted the stale litellm_oss_daily_2026_07_20 branch (no updates since Aug 3, and it no longer merges cleanly with main). This is the same 4-file change re-applied on top of current main.

Pre-Submission checklist

  • My PR's scope is as isolated as possible; it only solves 1 specific problem (three Dockerfiles plus one container-structure assertion; no Python, no lockfiles)
  • Checked locally: hadolint reports no new findings in any of the three Dockerfiles compared with main; tini is in the public Wolfi index (tini-0.19.0-r26) and installs /usr/bin/tini; the root Dockerfile's ENTRYPOINT/CMD still pass the test_container_build_no_network_fetch check

Screenshots / Proof of Fix

Repro from #33599: postgres 16 + the litellm image with DATABASE_URL set. Before is ghcr.io/berriai/litellm:main-latest; after is the same image with only the entrypoint change applied.

# before
PID PPID STATE COMM
1 0 S (litellm)
56 1 Z (node-MainThread)
108 1 Z (node-MainThread)
160 1 Z (node-MainThread)
183 1 S (query-engine-li)

# after
PID PPID STATE COMM
1 0 S (tini)
6 1 S (litellm)
78 6 S (query-engine-li)

The unpatched container accumulates one defunct node process per prisma CLI invocation at startup. The patched container has tini at PID 1, no zombies, and /health/liveliness still returns "I'm alive!".

Type

🐛 Bug Fix

Changes

docker/prod_entrypoint.sh ends in exec litellm "$@", so litellm runs as PID 1. When DATABASE_URL is set the proxy shells out to the prisma CLI, a node program that forks a detached child. That child is reparented to PID 1, and since python is not an init nothing reaps it, leaving the permanent [node-MainThread] <defunct> zombie from #33414 (also #14739 and #10216).

  • Add Wolfi's tini to the runtime apk add line in Dockerfile, docker/Dockerfile.database, and docker/Dockerfile.non_root
  • Wrap each ENTRYPOINT as ["/usr/bin/tini", "--", <existing entrypoint>]
  • docker/tests/nonroot.yaml had drifted from the non_root image entrypoint (docker/prod_entrypoint.sh vs /app/docker/prod_entrypoint.sh); updated it to the new tini entrypoint

No application code changes. The in-process engine reaping (#48895) is complementary: it covers the query engine litellm owns, and tini covers orphans that get reparented to PID 1.

QA runbook

  1. Run any postgres, and run the image with DATABASE_URL set and a minimal config
  2. After startup, docker exec <ct> ps -ef and look for <defunct>
  3. Before this change, zombie node processes appear within the first minute; after it, none

…are reaped

The prisma CLI forks a detached node child that is reparented to PID 1
(the litellm python process) and never reaped, leaving permanent
<defunct> zombies (BerriAI#33414, BerriAI#14739, BerriAI#10216). Install Wolfi's tini in the
runtime stage and wrap the entrypoint with it in all three Dockerfiles.

Supersedes BerriAI#33599, which targeted the stale litellm_oss_daily_2026_07_20
branch.

Signed-off-by: Ian Alloway <200005377+ianalloway@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 31, 2026 15:46
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-31T15:46:23.775731Z
We couldn’t complete this review. Comment @codex review to try again.
576874d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown
Contributor

#33414 was fixed by #52642 on main, so this pull request is closed. Reopen it if something was missed.

@github-actions github-actions Bot closed this Nov 18, 2026
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.

[Bug]: Docker LiteLLM is leaving Zombie Processes alive

2 participants