Skip to content

[Bug] Container leaves zombie process #386

Description

@santisbon

What went wrong?

When I log into a node on my k8s cluster I see:
There is 1 zombie process

The zombie PID is associated with sh and I was able to trace the parent back to the bookorbit pod.

The most likely culprit is the HEALTHCHECK in the Dockerfile which uses shell form spawning a shell process, potentially interfering with proper signal handling and process management.

Suggested fix: Change the HEALTHCHECK from shell form to exec form:

# Before (shell form)
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
  CMD node -e "const p=process.env.PORT||3000;fetch('http://127.0.0.1:'+p+'/api/v1/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"

# After (exec form)
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
  CMD ["node", "-e", "const p=process.env.PORT||3000;fetch('http://127.0.0.1:'+p+'/api/v1/health').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]

Steps to reproduce

  1. Run BookOrbit container (I deployed to Kubernetes).
  2. View zombie processes with ps -eo pid,ppid,stat,comm | awk '$3 ~ /Z/'. Your environment may or may not exhibit this behavior but mine does.

Expected vs actual behavior

Expected:
Running the container leaves no zombie processes.
Actual:
There is 1 zombie process on the node where the bookorbit container is running, associated to its pod.

Your setup

Book Orbit v1.10.0 bookorbit/bookorbit:latest
Deployment: Kubernetes (MicroK8s cluster)
OS: Ubuntu Server 26.04, Raspberry Pi

Relevant logs (optional)

Screenshots (optional)

No response

Before submitting

  • I've searched existing issues and this hasn't been reported yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleasedIssue or PR is included in a released version.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions