Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use init option to prevent zombie ddev-router, for #5705 #5707

Merged
merged 2 commits into from Jan 26, 2024

Conversation

stasadev
Copy link
Member

@stasadev stasadev commented Jan 17, 2024

The Issue

API error (500): Could not kill running container d8079abded3b448b54fc3d22bc0abfe10ffbeb69cd7066027655bbf5598992d5, cannot remove - container d8079abded3b PID 1968501 is zombie and can not be killed. Use the --init option when creating containers to run an init inside the container that forwards signals and reaps processes

How This PR Solves The Issue

The error suggests to use init, it doesn't harm to try it for ddev-router:

Use the --init option when creating containers to run an init inside the container that forwards signals and reaps processes

Manual Testing Instructions

I cannot reproduce this error, at least it should not break the tests. See the issue.

Automated Testing Overview

Related Issue Link(s)

Release/Deployment Notes

Copy link

github-actions bot commented Jan 17, 2024

@jonaseberle
Copy link
Collaborator

That fixes it for me. Thank you Stanislav!

@stasadev stasadev marked this pull request as ready for review January 18, 2024 18:24
@stasadev stasadev requested a review from a team as a code owner January 18, 2024 18:24
@stasadev
Copy link
Member Author

Great! This will make things a little easier.

@rfay
Copy link
Member

rfay commented Jan 19, 2024

The SO article implies that this injects a tini process as parent of the traefik process. It seems like that could possibly have other implications. init is a strange name for them to give that behavior.

@stasadev
Copy link
Member Author

Yeah, I don't really know what this change can bring and how safe it is.

Copy link
Member

@rfay rfay left a comment

Choose a reason for hiding this comment

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

I think this is fine. However, since we have only had the problem with the traefik router, why don't we just add the init option if we're running traefik? (Just move the init down a line.)

Apparently there is a path where the traefik binary doesn't handle signals correctly, and maybe that's what's happening.

With this, we see /sbin/docker-init injected as pid 1 in the container:

rfay@rfay-surface-goo:~/workspace/d10$ docker exec -it ddev-router bash
f70c5494795b:/mnt/ddev-global-cache/traefik$ ps -ef
PID   USER     TIME  COMMAND
    1 1000      0:00 /sbin/docker-init -- /entrypoint.sh --configFile=/mnt/ddev-global-cache/traefik/static_config.yaml
    7 1000      0:00 traefik traefik --configFile=/mnt/ddev-

docker-init is just `tini1 apparently packaged for docker's use, not sure why they use a different name:

f70c5494795b:/mnt/ddev-global-cache/traefik$ /sbin/docker-init -h
docker-init (tini version 0.19.0 - git.de40ad0)
Usage: docker-init [OPTIONS] PROGRAM -- [ARGS] | --version

Execute a program under the supervision of a valid init process (docker-init)

Command line options:

  --version: Show version and exit.
  -h: Show this help message and exit.
  -s: Register as a process subreaper (requires Linux >= 3.4).
  -p SIGNAL: Trigger SIGNAL when parent dies, e.g. "-p SIGKILL".
  -v: Generate more verbose output. Repeat up to 3 times.
  -w: Print a warning when processes are getting reaped.
  -g: Send signals to the child's process group.
  -e EXIT_CODE: Remap EXIT_CODE (from 0 to 255) to 0.
  -l: Show license and exit.

Environment variables:

  TINI_SUBREAPER: Register as a process subreaper (requires Linux >= 3.4).
  TINI_VERBOSITY: Set the verbosity level (default: 1).
  TINI_KILL_PROCESS_GROUP: Send signals to the child's process group.

I'm surprised not to see issues in the traefik queue about zombies.

Co-authored-by: Randy Fay <randy@randyfay.com>
@stasadev
Copy link
Member Author

Great, thank you. I didn't know that this didn't happen with nginx-proxy, so it makes sense to only use it with Traefik.

I've restarted the tests to make sure everything is fine.

@stasadev stasadev merged commit d121c88 into ddev:master Jan 26, 2024
18 checks passed
@stasadev stasadev deleted the 20240117_stasadev_init_for_ddev-router branch January 26, 2024 19:59
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.

None yet

3 participants