Skip to content

Studio and pg-meta containers collect zombie processes when their healthcheck times out #7776

Done

Description

@sudhi76

Affected area

Docker

Supabase CLI version

v3.3.0 (also current develop, 17e8cbf)

Operating system

macOS 15.6 (Docker via Colima). The behavior is in the containers, so it's not OS-specific.

Installation method

Other (reproduced with the CLI's healthcheck flags directly, see below)

Command

supabase start

Actual output

Studio's container accumulates defunct node processes under a running next-server, as reported in supabase/supabase#53512. That report comes from a CLI-started container. The maintainer there asked for a separate fix in the CLI: supabase/supabase#53512 (comment)

Expected behavior

No zombie processes, however often the healthcheck times out.

Steps to reproduce

The CLI creates containers with docker create --health-cmd, which always runs the check as /bin/sh -c "<cmd>" (see buildHealthCmdArg in apps/cli/src/command-internal/db-bootstrap/docker-create-args.ts). For Studio and pg-meta the check is:

  • apps/cli/src/commands/start/services/studio.service.ts:152: node --eval="fetch('.../api/platform/profile')...", timeout 2s
  • apps/cli/src/commands/start/services/pg-meta.service.ts:50: node --eval="fetch('.../health')...", timeout 2s

When a check is still running at the timeout, Docker kills sh, and the node child is reparented to PID 1. In both images PID 1 is the Node server itself, with no init process, so it never reaps the child, which stays as a zombie.

The same flags the CLI passes, with a check that always hangs to force the timeout:

IMG=supabase/studio:2026.11.23-sha-4a73166
HANG="node --eval=\"fetch('http://10.255.255.1/').then(() => {})\""
docker run -d --name zc-plain --health-interval=3s --health-timeout=1s --health-cmd "$HANG" $IMG
docker run -d --name zc-exec  --health-interval=3s --health-timeout=1s --health-cmd "exec $HANG" $IMG
sleep 45
for c in zc-plain zc-exec; do
  docker exec $c sh -c 'grep -l "^State:.*Z" /proc/[0-9]*/status | wc -l'
done
# zc-plain: 8, zc-exec: 0

supabase/postgres-meta:v0.100.1 behaves the same way.

Docker and service versions

supabase/studio:2026.11.23-sha-4a73166, supabase/postgres-meta:v0.100.1, Docker Engine on Colima.

Additional context

Suggested fix: prefix both healthcheck commands with exec, so sh replaces itself with node. Docker then kills node directly at the timeout, and no orphan is left. The rest of the command is unchanged. With the real Studio route, the exec form still exits 0 when healthy and 1 on a non-200 response.

Adding --init to these two containers also gives 0 zombies, but exec needs no new container option.

The self-hosted Docker Compose setup is being fixed separately in supabase/supabase#53934.

I'd be happy to open the PR once this is open-for-contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions