Repository navigation
Conversation
FVM handled only SIGINT from a terminal, which the terminal also sends to Flutter itself. When another program sent SIGTERM to the FVM process, for example patrol test stopping `fvm flutter run`, Dart's default handler ended FVM at once and the Flutter tool and its frontend_server kept running with PID 1 as parent. Forward SIGTERM and SIGHUP, and SIGINT when stdin is not a terminal, to the child, wait for it to exit, then exit with 128 + the signal number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@cdeil is attempting to deploy a commit to the FlutterTools Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
FVM runs Flutter as a child process and waits for it.
ProcessService.runhandles only SIGINT, and only when stdin is a terminal (#1054). That covers Ctrl+C, which the terminal also delivers to Flutter itself. A SIGTERM or SIGHUP that another program sends to the FVM process, such as a test runner, an IDE, a CI timeout ortimeout(1), ends FVM at once through Dart's default handler. The Flutter tool and the processes it started keep running, with PID 1 as their parent.To reproduce in any project with an
.fvmrc(macOS, FVM 4.3.2, Flutter 3.47.8):The Flutter tool and its frontend_server are still running. Plain
flutter runexits cleanly on the same signal.We ran into this with Patrol, which stops
flutter runwith SIGTERM when it is configured with--flutter-command="fvm flutter". Every web test run left the Flutter tool and its frontend_server behind, about 2.6 GB RSS on Linux.Change
ForceExit, like the existing SIGINT path.On POSIX the child starts through
/bin/sh -c. The shell runs the single command withexec, so the forwarded signal reaches Flutter.Testing
test/src/services/process_service_signal_forwarding_test.dartstarts an FVM parent without a terminal and a signal-aware child, sends SIGTERM or SIGHUP to the parent only, and checks that the child finished its cleanup before the parent exited with 143 or 129. Both cases fail without this change, because the child never receives the signal, and pass with it.process_service_test.dartand the SIGINT PTY test still pass.dart analyze --fatal-infosanddart formatare clean. I could not rundcm analyze liblocally.