Skip to content

fix: add opt-in proxy SIGTERM forwarding (4.3.2) - #1076

Closed
leoafarias wants to merge 7 commits into
mainfrom
fix/forward-proxy-sigterm
Closed

leoafarias wants to merge 7 commits into
mainfrom
fix/forward-proxy-sigterm

Conversation

@leoafarias

@leoafarias leoafarias commented Sep 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Prepare 4.3.2 with opt-in PID-only cancellation: FVM_FORWARD_SIGTERM=true forwards SIGTERM to a POSIX proxy child, waits for cleanup, and exits 143. Default process-group cancellation and shell behavior remain unchanged, avoiding duplicate signals that can interrupt cleanup. Enable this per invocation only when the runner signals FVM's PID.

Also restore live stdin/stdout/stderr and normal child status for system-PATH fallback. Terminal Ctrl+C remains supported; arbitrary descendant supervision and parent-death detection are outside this change. Related to #1046.

Validation

  • Independent compiled-CLI reproductions verify opt-in PID cancellation and default group cancellation each deliver one signal and finish child cleanup.

  • New group regressions fail against the automatic-forwarding revision and pass with this fix. Tests cover direct/fallback paths, live stdio, exit status, and terminal Ctrl+C; Windows runs the normal-exit cases.

  • 511 non-SDK tests, the 461-test CI selection, Dart analysis, DCM, isolated manual smoke, and repository hooks passed locally. Tests use GIT_CONFIG_NOSYSTEM=1 for existing Apple Git fixture compatibility.

  • All nine platform, integration, and migration CI jobs passed on 75dbc088.

  • Follow-up commit adds test/src/services/process_service_posix_launch_test.dart, pinning that forwarding mode resolves the executable through the supplied PATH without a shell, surfaces a missing executable as ProcessException (exit 2), and that the default shell launch still exits 127. Docs and changelog note the exit-status difference.

@vercel

vercel Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
fvm Ready Ready Preview Oct 14, 2026 2:58pm UTC

@leoafarias leoafarias changed the title fix: forward SIGTERM to proxied commands (4.3.2) fix: add opt-in proxy SIGTERM forwarding (4.3.2) Sep 10, 2026
Prove that forwarding resolves the executable through the supplied PATH
without a shell, that a missing executable then raises ProcessException,
and that the default shell launch still exits 127. Document the exit
status change for the forwarding mode.

@leoafarias leoafarias left a comment •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: OK to merge. Making SIGTERM forwarding opt-in is the right call, and the system-PATH fallback fix is the most valuable part of this PR.

Checked claims

  • Forwarding by default would be harmful. test_core 0.6.8 (lib/src/executable.dart, completeShutdown) cancels its signal subscription on the first SIGINT/SIGTERM. A second SIGTERM then hits Dart's default handler and kills dart test before runner.close() finishes. When a runner kills the whole process group (systemd KillMode=control-group, kill -TERM -pgid), forwarding would deliver that second signal. Keeping it opt-in avoids this, similar to how tini only signals the group when you pass -g.
  • The fallback is broken on main. I compiled both revisions and ran them with a fake flutter on PATH, no pinned or global version, and an isolated HOME/FVM_CACHE_PATH:
    • main: fvm flutter --version prints nothing (exit 0). With the child exiting 3, the output only appears inside a ProcessException dump.
    • this PR: output streams live, and the exit status passes through (0 and 3).
      This affects every fvm flutter / fvm dart / fvm exec call outside a pinned project, so it's worth highlighting in the 4.3.2 notes.
  • The code covers the start-up race (a signal arriving while Process.start is pending), cancels the subscriptions in finally, skips Windows, and exits 143.

Nits (optional)

  1. context.environment['FVM_FORWARD_SIGTERM'] == 'true' is case-sensitive. FVM_USE_GIT_CACHE goes through stringToBool (case-insensitive), so FVM_FORWARD_SIGTERM=TRUE is silently ignored. Using stringToBool(... ?? '') == true would make them consistent.
  2. No caller passes runInShell (it didn't on main either). The bool? parameter could be dropped and the launch mode computed from forwardSigterm alone, leaving one less option to keep documented.

Scope note: the SIGTERM handler is only active while an echoed child is running. A SIGTERM during install/setup (which uses Process.run) still ends FVM immediately. That's fine for this PR, and the docs already say FVM doesn't supervise every descendant.


Resolve the pubspec.yaml conflict with the btwld migration (#1078):
keep version 4.3.2 from this branch and the new btwld homepage.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SmK6LGRTwTTAD1GQuMw4q

This branch was successfully deployed

1 active deployment
Preview — df872755 Deployed Oct 14, 2026 by vercel[bot]
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.

2 participants