jenkinsci/docker

jenkins.sh zombie when launching with `docker stack deploy`

BCircleTech opened this issue · 6 comments

Jenkins and plugins versions report

Environment
Image ID: 1f29cd814a37

What Operating System are you using (both controller, and any agents involved in the problem)?

Environment:

  • Machine: AWS EC2 t2.micro
  • OS: Ubuntu 20.04
  • Docker: 20.10.12
  • Dcoker Mode: docker swarm
  • Jenkins Image ID: 1f29cd814a37
  • Reverse Proxy: Nginx
  • agent: None

Reproduction steps

Just Deploy the following docker stack yml in my clean machine with cmd docker stack deploy:

version: "3.8"

services:

    jenkins:
        image: jenkins/jenkins
        user: root
        volumes:
            - jenkins_volume:/var/jenkins_home
        networks:
            - regular_network
            - jenkins_network
        deploy:
            mode: replicated
            replicas: 1
            placement:
                constraints:
                    - node.labels.jenkins == true
            restart_policy:
                delay: 10s
                max_attempts: 3
                window: 60s

volumes:

    jenkins_volume:
        driver_opts:
            type: nfs
            o: addr=${NFS_SERVER_IP},${NFS_SERVER_OPTIONS}
            device: :/jenkins

networks:

    regular_network:
        driver: overlay

    portainer_network:
        driver: overlay

Expected Results

Inside the container, there is no zombie process.

Actual Results

Everything works fine actually, but a zombie process (defunct) in the container immediately appearing when launching:

root@4b25ec579515:/# ps axo stat,ppid,pid,comm
STAT    PPID     PID COMMAND
Ss         0       1 tini
Sl         1       9 java
Z          9      14 jenkins.sh <defunct>
Ss         0      73 bash
R+        73     402 ps

Also, the output of Jenkins are following with few warnings:

...
2022-02-02 12:47:52.270+0000 [id=1]	WARNING	o.e.j.s.handler.ContextHandler#setContextPath: Empty contextPath
...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/var/jenkins_home/war/WEB-INF/lib/groovy-all-2.4.21.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
...

Anything else?

This is not the first time I got this issue. When I firstly learn Jenkins in last year, it appeared. Actually, I didn't do any configuration, just run the image simply and the zombie process is there. I learned many about tini, zombies in agent, PID 1 in docker, and so on. But can't google out anything about "jenkins.sh zombie". So weird that only in my server it happens?

timja commented

not an expert here, but I would expect it to be reaped eventually:

https://github.com/krallin/tini#understanding-tini

not an expert here, but I would expect it to be reaped eventually:

https://github.com/krallin/tini#understanding-tini

Thank you for your info. I have checked and find something that may help:

According to the description, it seems that Tini only starts reaping zombies after receiving exit signals, not during running of Jenkins. This can explain why my container can gracefully exit and also the zembie can be eventually, in fact, cleaned at the same time. So maybe this zombie is not a problem for using and just not "pretty" I guess.

So, anyone has the same situation when using? Is that normal?

So, anyone has the same situation when using? Is that normal?

When I'm running my Jenkins controller from Docker with docker run (not using docker stack deploy), I monitor once an hour for defunct processes. There have been no defunct processes on my instance in the last 40 hours of checks. I don't know what might be different about docker stack deploy compared to docker run, but can report that I hardly ever see defunct processes with my controller. I have definitely seen them (for example, when a git server stops responding during a fetch to the controller).

So, anyone has the same situation when using? Is that normal?

When I'm running my Jenkins controller from Docker with docker run (not using docker stack deploy), I monitor once an hour for defunct processes. There have been no defunct processes on my instance in the last 40 hours of checks. I don't know what might be different about docker stack deploy compared to docker run, but can report that I hardly ever see defunct processes with my controller. I have definitely seen them (for example, when a git server stops responding during a fetch to the controller).

Thank you for your help. Well, in my case "docker stack deploy", the zombie process is appeared immediately alongside the starting of Jenkins. Up to now, it looks harmless and no BAD things happens, and you can gracefully remove the stack as well, without errors, warnings, waiting and any other issue. The zombie process will disappear subsequently. Where I will keep this issue open for few days and see if this should be concerned by the developpers. BTW, I didn't run any agent including the one in the master node.

Closing as no answer since more than 1 year