You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(self-hosted): reap orphaned healthcheck processes in studio and meta - #53934
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
Start a stack from this branch and check that studio and meta become healthy.
docker exec supabase-studio cat /proc/1/comm prints docker-init.
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'.
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.
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.
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.
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: 4
Check name
Status
Explanation
Title check
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
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
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.
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]>
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Self-hosted Studio collects zombie
nodeprocesses under a runningnext-server(#53512).Studio's healthcheck in
docker/docker-compose.ymlis shell form (CMD-SHELL), so Docker runs it assh -c "node -e ...". When a check is still running at its timeout, Docker killssh, and thenodechild 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.metahas the same setup:supabase/postgres-metarunsnodeas PID 1 and has a shell-formHEALTHCHECKin 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.ymlonly:["CMD", "node", "-e", ...]), so noshwrapper is left to orphan the child. Same command, timeout, and interval.init: true, so anything else that gets orphaned is reaped too.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:masterinit: false)init: trueonly (shell form)With the real healthchecks:
studioandmetabecome healthy, and PID 1 isdocker-initin both./api/platform/path.sh tests/test-self-hosted.sh: 47 passed, 0 failed.docker compose configis valid. No other overlay overrides the healthcheck orinitfor these services.Review instructions
studioandmetabecome healthy.docker exec supabase-studio cat /proc/1/commprintsdocker-init.studio, wait 45s, then count zombies withdocker exec supabase-studio sh -c 'grep -l "^State:.*Z" /proc/[0-9]*/status | wc -l'.Checklist
/write-the-docsor/edit-the-docsskill, which applies the docs style guide