Skip to content

fix(docker): disable Prisma's update check so it stops leaving zombie processes - #52642

Merged
kenneth-berri merged 3 commits into
BerriAI:mainfrom
kenneth-berri:litellm_disable_prisma_checkpoint
Nov 18, 2026
Merged

kenneth-berri merged 3 commits into
BerriAI:mainfrom
kenneth-berri:litellm_disable_prisma_checkpoint

Conversation

@kenneth-berri

@kenneth-berri kenneth-berri commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Handwritten 1-3 sentence description

Stops the Docker image from leaving zombie processes after startup with a database attached, by turning off a background update check in our database tool that we never used.

Details

Link to Devin session: https://app.devin.ai/sessions/396be2cf2c7c4dccbb2a5234010ae9db
Open in Devin Desktop: https://app.devin.ai/desktop/session/396be2cf2c7c4dccbb2a5234010ae9db?variant=devin
Requested by: @kenneth-berri

TLDR

Problem this solves:

  • The Docker image leaves [node-MainThread] <defunct> processes after startup
  • Server monitors flag them as zombie processes

How it solves it:

  • Sets CHECKPOINT_DISABLE=1 in the image
  • Prisma's background update check no longer starts

User Flow

Before: someone running the Docker image with a database sees zombie processes on the host after every start

  1. They run the image with DATABASE_URL set and wait for GET http://localhost:4000/health/liveliness to return 200
  2. They run ps -eo pid,ppid,stat,cmd on the host
  3. They see two or three [node-MainThread] <defunct> rows whose parent is the litellm process, and their monitoring reports zombie processes

After: the same start leaves no zombie processes

  1. They run the image with DATABASE_URL set and wait for GET http://localhost:4000/health/liveliness to return 200
  2. They run ps -eo pid,ppid,stat,cmd on the host
  3. No defunct row has the litellm process as its parent

Relevant issues

Fixes #33414

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Screenshots / Proof of Fix

Both images were built from this checkout with the same command, and the only difference is the Dockerfile. Before uses the Dockerfile at the merge base and After uses the one at the PR tip. Each image was started next to a fresh postgres:16 container, with no init process, and the host process list was read 15 seconds after the liveliness check returned 200.

Build, run from the repo root:

docker build -f litellm/deploy/docker/Dockerfile \
  --build-arg MATURIN_PEP517_ARGS="--profile ci" \
  --build-arg LITELLM_RELEASE_TAG=v0.0.0-lens-ci \
  -t litellm-33414:after .

The Before image used the same command with -f pointing at the output of git show 0e62b0690249755e3d3bfa2c97d2a31f3d4b4155:litellm/deploy/docker/Dockerfile and the tag litellm-33414:before.

config.yaml:

model_list:
  - model_name: gpt-4o
    litellm_params:
      model: openai/gpt-4o
      api_key: os.environ/OPENAI_API_KEY
run.sh, used as ./run.sh <image> <name>. Env vars passed to the proxy are DATABASE_URL, LITELLM_MASTER_KEY and OPENAI_API_KEY
#!/bin/bash
# usage: run.sh <image> <name>
IMG=$1; N=$2
docker rm -f pg-$N ll-$N >/dev/null 2>&1
docker network create net33414 >/dev/null 2>&1
docker run -d --name pg-$N --network net33414 -e POSTGRES_PASSWORD=pw -e POSTGRES_DB=litellm postgres:16 >/dev/null
until docker exec pg-$N pg_isready -U postgres >/dev/null 2>&1; do sleep 1; done; sleep 2
docker run -d --name ll-$N --network net33414 -p 0:4000 \
  -e DATABASE_URL=postgresql://postgres:pw@pg-$N:5432/litellm \
  -e LITELLM_MASTER_KEY=sk-$(openssl rand -hex 12) -e OPENAI_API_KEY=sk-none \
  -v $HOME/repro33414/config.yaml:/app/config.yaml $IMG --config /app/config.yaml >/dev/null
PORT=$(docker port ll-$N 4000 | head -1 | cut -d: -f2)
for i in $(seq 1 120); do
  [ "$(curl -s -o /dev/null -w '%{http_code}' localhost:$PORT/health/liveliness)" = 200 ] && break; sleep 2
done
sleep 15
echo "image=$IMG liveliness=$(curl -s -o /dev/null -w '%{http_code}' localhost:$PORT/health/liveliness)"
echo "CHECKPOINT_DISABLE in container env: $(docker exec ll-$N printenv CHECKPOINT_DISABLE || echo unset)"
PID=$(docker inspect -f '{{.State.Pid}}' ll-$N)
echo "litellm host pid=$PID, defunct children:"
ps -eo pid,ppid,stat,cmd | awk -v p=$PID '$2==p && $3 ~ /^Z/'
echo "zombie count: $(ps -eo pid,ppid,stat,cmd | awk -v p=$PID '$2==p && $3 ~ /^Z/' | wc -l)"

Before (0e62b06)

  1. ./run.sh litellm-33414:before before
image=litellm-33414:before liveliness=200
CHECKPOINT_DISABLE in container env: unset
litellm host pid=142474, defunct children:
 142708  142474 Zs   [node-MainThread] <defunct>
 142799  142474 Zs   [node-MainThread] <defunct>
zombie count: 2

After (a849057)

  1. ./run.sh litellm-33414:after after
image=litellm-33414:after liveliness=200
CHECKPOINT_DISABLE in container env: 1
litellm host pid=116145, defunct children:
zombie count: 0

Regression test

test_proxy_startup_leaves_no_zombie_processes boots the built image against a fresh Postgres and fails if any defunct process is left after startup. It was run against both images with LITELLM_IMAGE=<image> python -m pytest --noconftest -q tests/integration/database/image/test_offline_image_migration.py -k zombie.

Against litellm-33414:before:

E           AssertionError: the proxy left defunct processes behind after startup: (Process(pid=130, comm='node-MainThread', state='Z', ppid=1), Process(pid=220, comm='node-MainThread', state='Z', ppid=1)). The proxy is PID 1 in the container and never reaps processes it did not start, so a helper the Prisma CLI detached during the startup migrations was reparented to it and stays in the process table, where host monitoring reports it as a zombie.
1 failed, 3 deselected, 2 warnings in 23.65s

Against litellm-33414:after:

1 passed, 3 deselected, 2 warnings in 23.39s

Type

🐛 Bug Fix

Caveats (if any)

Low

  • The new test runs in the image-scan workflow, which only runs when image files change
  • Only this Dockerfile was changed and tested, other images were not checked
  • Orphans from other sources would still show up as zombies, since the image has no init process

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Note

Low Risk
Single env var in the Docker image plus an integration test gated on LITELLM_IMAGE; no runtime application logic changes.

Overview
Sets CHECKPOINT_DISABLE=1 in the runtime Docker image so Prisma does not run its background update/checkpoint path, which was spawning detached node helpers during startup migrations.

Because the proxy runs as PID 1 with no init, those children were reparented to it and showed up as [node-MainThread] <defunct> on the host after liveliness succeeded.

Adds an image-gated integration test (test_proxy_startup_leaves_no_zombie_processes) that boots the built image against Postgres, waits for /health/liveliness, then asserts no zombie processes remain in /proc.

Reviewed by Cursor Bugbot for commit 348a9d3. Bugbot is set up for automated code reviews on this repo. Configure here.

@veria-ai

veria-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

No security issues were found in this pull request.

Reviews

@kenneth-berri

Copy link
Copy Markdown
Collaborator Author

@greptile

@kenneth-berri

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

@greptile-apps

greptile-apps Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes appear safe to merge.

Summary

Disables Prisma’s background update check in the Docker image and adds a database-backed startup test for zombie processes. The latest changes give the test helpers typed rows and clearer assertion messages.

  • The Docker image disables Prisma’s background check during proxy startup.

Reviews (3) · Last reviewed commit: "test(docker): type the zombie check help..." · Reviewed by Greptile

Comment thread litellm/deploy/docker/Dockerfile Resolved
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

⚠️ 2 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 45 untouched benchmarks


Comparing kenneth-berri:litellm_disable_prisma_checkpoint (348a9d3) with main (bb29e9a)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (36f23db) during the generation of this report, so bb29e9a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@kenneth-berri

Copy link
Copy Markdown
Collaborator Author

@greptile

@kenneth-berri

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot 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.

Stale Bugbot comment from a previous run.

@kenneth-berri

Copy link
Copy Markdown
Collaborator Author

@greptile

@kenneth-berri

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot 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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 348a9d3. Configure here.

@kenneth-berri
kenneth-berri merged commit 92d41e6 into BerriAI:main Nov 18, 2026
56 of 58 checks passed
yucheng-berri added a commit that referenced this pull request Nov 18, 2026
Ports CHECKPOINT_DISABLE=1 from main's Dockerfile (#52642), so the FIPS image stops leaving zombie Prisma processes the same way.
yucheng-berri added a commit that referenced this pull request Nov 20, 2026
* feat(docker): add FIPS 140-3 image with build-time crypto verification

Dockerfile.fips builds on chainguard-base-fips with FIPS-provider-linked
python/node/openssl from the org apk repo (CMVP #5132). A fips-check
stage runs openssl-fips-test and an ELF allowlist gate: every native
binary must be in the reviewed fips_elf_inventory.txt or carry an
explicit bundled-crypto waiver, so new native deps fail the build until
reviewed. Known offenders are waived pending the dependency-fix
workstream and the report ships at /fips-scan-report.txt

* fix(docker): bring the FIPS image up to today's Dockerfile

Ports main's Dockerfile changes since #41802 was written: pgbouncer 1.26.0, the dashboard vendor folder, rust for the maturin build, libssl3, the packaging/litellm-proxy workspace member, the admin-mcp group and LITELLM_RELEASE_TAG. litellm-proxy, the opt-in Rust forwarding server, stays out of this image.

The Wolfi base now ships OpenSSL 4, so the scan also counts a binary linked against the system libcrypto.so.4 as system-linked. The inventory adds the amd64 binaries from today's lock and keeps #41802's arm64 entries.

* ci: list the FIPS Dockerfile in the CI coverage allowlist

No pull request job holds the Chainguard token its base image and apk repo need.

* fix(fips): fail the ELF scan on a missing root and add its tests

The scan now stops when a root is missing, find cannot read a directory, or no ELF binary is found,
instead of printing PASS for zero binaries. The enterprise admin UI build step gets the Chainguard
apk login like every other apk call in this Dockerfile.

* revert(fips): keep the Chainguard login out of the admin UI build

The pinned virtualapk repo answers without a login, so build_admin_ui.sh installs curl as is,
and exporting the token there would hand it to the nvm installer and the npm build.

* refactor(fips): pin scan waivers to exact binaries, move scan tests to their mirrored path

Each waiver now names the one binary seen in the image, so a new package next to a waived one
fails the scan. The unused xmlsec and libsodium waivers are gone. Build steps move from
Dockerfile comments to the docker README.

* test(fips): run the scan tests with main's other shell-script tests in test-linting

tests/unit forbids subprocesses, so the scan tests move next to test_e2e_idp_stack.py, which
already exercises a shell script the same way, and get their own test-linting step.

* docs(fips): note the PBMAC1 requirement for a PKCS#12 sslidentity in the FIPS image

* test(fips): pin the scan's match on wheel libs that carry an upstream and an auditwheel hash

* fix(fips): disable Prisma's update check in the FIPS image too

Ports CHECKPOINT_DISABLE=1 from main's Dockerfile (#52642), so the FIPS image stops leaving zombie Prisma processes the same way.

* fix(fips): close the crypto scan's path, name and symlink gaps

- Waivers match one exact path under the venv's site-packages or /opt/prisma,
  so a waived name nested deeper or inside a look-alike folder still fails
- Names with leading or trailing spaces are scanned, and a newline anywhere in
  a path fails the scan before it starts
- A symlink that points outside the roots is scanned at its own path; one that
  dangles or points at a folder outside the roots fails the scan
- A crypto library is flagged by its file name too, so psycopg-binary's libssl,
  libk5crypto and libcrypt are now waived by name instead of listed as clean
- The venv's three python links join the inventory

---------

Co-authored-by: Oliver Jensen <oliver@berri.ai>
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