Skip to content

fix(self-hosted): reap orphaned healthcheck processes in studio and meta - #53934

Merged
aantti merged 4 commits into
supabase:masterfrom
sudhi76:fix/self-hosted-studio-zombies
Nov 26, 2026
Merged

aantti merged 4 commits into
supabase:masterfrom
sudhi76:fix/self-hosted-studio-zombies

Conversation

@sudhi76

@sudhi76 sudhi76 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Self-hosted Studio collects zombie node processes under a running next-server (#53512).

Studio's healthcheck in docker/docker-compose.yml is shell form (CMD-SHELL), so Docker runs it as sh -c "node -e ...". When a check is still running at its timeout, Docker kills sh, and the node child is reparented to PID 1. In the Studio container PID 1 is the Node server itself, with no init process, so the orphan is never reaped and stays as a zombie.

meta has the same setup: supabase/postgres-meta runs node as PID 1 and has a shell-form HEALTHCHECK in its image.

Part of #53512. This covers self-hosted. The reporter's container comes from the Supabase CLI, which defines its own Studio healthcheck, so that needs a separate PR in supabase/cli.

Solution

docker/docker-compose.yml only:

  • studio: the healthcheck runs in exec form (["CMD", "node", "-e", ...]), so no sh wrapper is left to orphan the child. Same command, timeout, and interval.
  • studio: init: true, so anything else that gets orphaned is reaped too.
  • meta: init: true. Its healthcheck comes from the image, so an init process is the only fix available from the compose file.

Testing

Local stack from this branch, default (Envoy) config. To force the timeout, a test-only override replaced the healthchecks with one that always hangs (fetch('http://10.255.255.1/'), interval 3s, timeout 1s). Zombie count after 45s:

Config studio meta
master 6 8
This PR 0 0
Exec form only (init: false) 0 n/a
init: true only (shell form) 0 0

With the real healthchecks:

  • studio and meta become healthy, and PID 1 is docker-init in both.
  • The exec-form check still fails when the route doesn't answer 200: exit code 1 on a non-existent /api/platform/ path.
  • sh tests/test-self-hosted.sh: 47 passed, 0 failed.
  • docker compose config is valid. No other overlay overrides the healthcheck or init for these services.

Review instructions

  1. Start a stack from this branch and check that studio and meta become healthy.
  2. docker exec supabase-studio cat /proc/1/comm prints docker-init.
  3. Optional: apply a hanging healthcheck to studio, wait 45s, then count zombies with docker exec supabase-studio sh -c 'grep -l "^State:.*Z" /proc/[0-9]*/status | wc -l'.

Checklist

  • I have read CONTRIBUTING.md
  • If I wrote a new docs topic or edited an existing topic, I used the /write-the-docs or /edit-the-docs skill, which applies the docs style guide

When a shell-form healthcheck times out, Docker kills the sh wrapper and
the node child is reparented to PID 1. In Studio and postgres-meta, PID 1
is the Node server itself, which never reaps it, so zombies pile up.

- studio: run the healthcheck in exec form, so no sh wrapper is left
  to orphan the child, and add init: true
- meta: add init: true; its shell-form healthcheck comes from the image

Part of supabase#53512 (self-hosted). The CLI healthcheck needs its own fix in supabase/cli.
@sudhi76
sudhi76 requested review from a team as code owners November 24, 2026 10:11
@sudhi76
sudhi76 requested a review from kanadgupta November 24, 2026 10:11
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
design-system Ready Ready Preview Nov 26, 2026 11:23am UTC
docs Error Error Nov 26, 2026 11:23am UTC
kb Error Error Nov 26, 2026 11:23am UTC
studio-self-hosted Error Error Nov 26, 2026 11:23am UTC
studio-staging Error Error Nov 26, 2026 11:23am UTC
ui-library Error Error Nov 26, 2026 11:23am UTC
zone-www-dot-com Error Error Nov 26, 2026 11:23am UTC
1 Skipped Deployment
Project Deployment Actions Updated
studio Ignored Ignored Nov 26, 2026 11:23am UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for contributing to Supabase! ❤️ Our team will review your PR.

A few tips for a smoother review process:

  • If you have a local version of the repo, run pnpm run format to make sure formatting checks pass.
  • Once we've reviewed your PR, please don't trivially merge master (don't click Update branch if there are no merge conflicts to be fixed). This invalidates any pre-merge checks we've run.

@vercel

vercel Bot commented Nov 24, 2026

Copy link
Copy Markdown

@sudhi76 is attempting to deploy a commit to the Supabase Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 57eb10e and 3cca836.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Compose enables the init process for Studio and meta. Studio’s healthcheck runs Node with separate arguments and still fails when /api/platform/profile returns a status other than 200.

Changes: Compose startup settings

Layer / File(s) Summary
Service startup and healthcheck
docker/docker-compose.yml
Studio and meta enable the Compose init process. Studio’s healthcheck uses an exec-form Node command to check /api/platform/profile and fails when the response status is not 200.

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Bug fix

Possibly related issues

  • supabase/supabase#53512 — The issue concerns zombie child processes in Studio. This change enables init, but the issue notes that init does not normally reap children of a living parent, so it does not address the described cause.

Suggested labels: self-hosted

Suggested reviewers: aantti

Merge Risk: Minimal · previous review 57eb1

This change makes self-hosted Studio and meta healthchecks reap timed-out child processes and gives meta a healthcheck under Podman as well. No actionable merge risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix (reaping orphaned healthcheck processes) and the affected services (studio and meta), which matches the compose changes: exec-form Studio healthcheck, init: true on studio and …
Description check Passed The description follows the template. It has Problem and Solution sections, with the problem stated and linked to issue #53512. It includes Review instructions as a numbered procedure and a completed …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix (reaping orphaned healthcheck processes) and the affected services (studio and meta), which matches the compose changes: exec-form Studio healthcheck, init: true on studio and meta, and a Compose-defined meta healthcheck. The title is specific and accurate, though it is long at 72 characters.

Full details: Description check

Explanation

The description follows the template. It has Problem and Solution sections, with the problem stated and linked to issue #53512. It includes Review instructions as a numbered procedure and a completed Checklist. The Preview links section is optional and omitted, which is acceptable. The Solution gives the key choices (exec form, init: true, and the meta healthcheck rationale), and the Testing section adds evidence.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f6a116d and 57eb10e.

Files selected for processing: 1

  • docker/docker-compose.yml

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

aantti and others added 2 commits November 24, 2026 12:53
Podman ignores the HEALTHCHECK embedded in the postgres-meta image (it is
pushed as an OCI image), so meta had no healthcheck there. Define the
same check in exec form in docker-compose.yml so Docker and Podman behave
the same.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@aantti

aantti commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Thanks for this! I pushed one commit on top: meta now defines its healthcheck in docker-compose.yml. The image's built-in HEALTHCHECK is ignored by Podman, because the image is published as OCI, so meta had no healthcheck at all there. With it in compose, Docker and Podman behave the same. Tested on Docker 29.8 and Podman 6.1.4: studio and meta become healthy, and PID 1 is the init process in both.

@aantti
aantti enabled auto-merge (squash) November 26, 2026 11:17
@aantti
aantti merged commit 2a09c73 into supabase:master Nov 26, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

self-hosted Related to self-hosted Supabase

Projects

Development

Successfully merging this pull request may close these issues.

2 participants