Skip to content

fix(aio): exec supervisord so the container handles stop signals - #9625

Open
smalyu wants to merge 1 commit into
makeplane:previewfrom
smalyu:fix/aio-exec-supervisord
Open

fix(aio): exec supervisord so the container handles stop signals#9625
smalyu wants to merge 1 commit into
makeplane:previewfrom
smalyu:fix/aio-exec-supervisord

Conversation

@smalyu

@smalyu smalyu commented Aug 15, 2026

Copy link
Copy Markdown

Description

main() in the AIO entrypoint ends by launching supervisord as a child process:

    /usr/local/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf

Because it is not exec'd, PID 1 stays bash running start.sh. A non-interactive bash ignores SIGINT
and does not forward signals to children, so a stop signal sent to the container reaches nothing that acts
on it: supervisord never begins its shutdown, and the runtime waits out its full stop timeout before
killing the container. On Docker (SIGTERM, 10 s default) this shows up as every docker stop taking the
full grace period; on platforms that send SIGINT — Fly.io, for example — the container sits until the
hard kill.

Adding exec makes supervisord PID 1, so it receives signals directly and shuts its programs down. In our
deployment container stop went from the full timeout to about two seconds.

The call is the last statement of main(), followed only by main "$@", so exec replaces the shell
without skipping any code.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Diff

--- a/deployments/aio/community/start.sh
+++ b/deployments/aio/community/start.sh
@@ main(){
     # load plane.env as exported variables
     export $(grep -v '^#' plane.env | xargs)
 
-    /usr/local/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf
+    exec /usr/local/bin/supervisord -c /etc/supervisor/conf.d/supervisor.conf
 }

Test scenarios

Check Before After
ps inside a running container PID 1 is bash /app/start.sh PID 1 is supervisord
docker stop (SIGTERM) waits the full grace period, then SIGKILL exits in ~2 s, programs shut down
stop signal SIGINT (Fly.io) ignored; container waits for hard kill supervisord shuts down
normal startup, all services unchanged unchanged

References

Observed on makeplane/plane-aio-community:v1.4.1 running on Fly.io, where the stop signal is SIGINT.
We currently carry this as a local patch.

Summary by CodeRabbit

  • Chores
    • Improved application process handling during startup by running Supervisor directly as the main process.
    • Existing Supervisor configuration and startup behavior remain unchanged.

@smalyu
smalyu requested a review from mguptahub as a code owner August 15, 2026 12:30
@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ad27d45-6737-489c-82f1-5a87885bcfbb

📥 Commits

Reviewing files that changed from the base of the PR and between 1c8a60f and 0a7be61.

📒 Files selected for processing (1)
  • deployments/aio/community/start.sh

📝 Walkthrough

Walkthrough

The startup script now uses exec to launch supervisord, replacing the shell process while preserving its existing configuration and arguments.

Changes

Supervisor process launch

Layer / File(s) Summary
Replace shell with Supervisor
deployments/aio/community/start.sh
The script launches supervisord with exec instead of running it as a child process.

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

Merge Risk: ⚪ Minimal · up to 0a7be

The change makes supervisord receive container stop signals directly without altering normal startup behavior; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: mguptahub

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: executing supervisord as PID 1 so the container handles stop signals.
Description check ✅ Passed The description explains the problem, solution, impact, change type, test scenarios, and reference context in the required template structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant