Skip to content

fix(docker): add tini init to reap zombie chromium processes#478

Draft
manoj1919 wants to merge 1 commit into
stickerdaniel:mainfrom
manoj1919:fix/477-docker-zombie-reaping
Draft

fix(docker): add tini init to reap zombie chromium processes#478
manoj1919 wants to merge 1 commit into
stickerdaniel:mainfrom
manoj1919:fix/477-docker-zombie-reaping

Conversation

@manoj1919

Copy link
Copy Markdown

Summary

The container runs python as PID 1 (ENTRYPOINT ["python", "-m", "linkedin_mcp_server"]). When Patchright/Chromium helper processes exit, the kernel reparents them to PID 1, but Python never waitpid()s them, so they accumulate as zombie (<defunct>) chrome-headless processes for the life of the container.

This adds tini as a minimal init so PID 1 reaps orphaned subprocesses.

RUN apt-get update && apt-get install -y --no-install-recommends tini && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["tini", "--", "python", "-m", "linkedin_mcp_server"]

Fixing it in the image (rather than telling users to pass --init / compose init: true) means plain docker run consumers are covered too.

Verification

Built the image and confirmed PID 1 inside the container is now an init wrapping Python, with no zombies after exercising the Chromium-launching bridge flow:

PID 1: /sbin/...init -- python -m linkedin_mcp_server ...
process tree: init(1)---python(...)
zombies: none

Closes #477

Synthetic prompt

The Dockerized server leaks zombie chrome-headless processes because Python runs as PID 1 with no init to reap orphaned Chromium subprocesses. Add tini to the Dockerfile and make it the entrypoint (tini -- python -m linkedin_mcp_server) so PID 1 reaps zombies, fixing it at the image level so plain docker run users benefit without --init.

Generated with Claude Opus 4.8

Python runs as PID 1 in the container, so Chromium helper processes
reparented to it on exit are never waited on and accumulate as zombies.
Add tini as the entrypoint init so PID 1 reaps orphaned subprocesses.

Fixes stickerdaniel#477
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.

Docker container leaks zombie chrome-headless processes (no init/reaper)

1 participant