Skip to content

Processes started with bash file flutter/bin/dart do not terminate children processes when killed #98435

Closed

Description

@kenzieschmoll

which dart on my machine points to path/to/flutter/bin/dart. I was writing a test in DDS and attempting to start a process:

final process = await Process.start('dart', args);

Since dart points to flutter/bin/dart, this actually starts a bash process, not a dart process. Later in my code, I attempted to kill this process: process.kill(); and was checking that other parts of the ecosystem responded accordingly to the process being killed (specifically, I was verifying that DevTools would disconnect). Calling process.kill() killed the bash process, but not any subprocesses that were started by the bash process (i.e. the dart process that DevTools should be responding to). I expect any user who points their Dart to flutter/bin/dart and is trying to spawn a process will hit this issue.

@bkonyi and I spent time debugging this this morning. Please add any additional details or thoughts.

Activity

  1. added
    in triagePresently being triaged by the triage team
    and removed
    in triagePresently being triaged by the triage team
    on Feb 15, 2022
  2. maheshj01 commented on Feb 15, 2022

    @maheshj01
    Member

    Hi @kenzieschmoll, Thanks for filing the issue. Would it be possible to share a minimal reproducible code?
    This looks related to #98395

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Feb 15, 2022
  4. github-actions commented on Mar 8, 2022

    @github-actions

    Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
    If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
    Thanks for your contribution.

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    in triagePresently being triaged by the triage team
    on Mar 8, 2022
  6. christopherfujino commented on Mar 8, 2022

    @christopherfujino
    Contributor

    It looks like this is blocked by dart-lang/sdk#22470

  7. bkonyi commented on Mar 8, 2022

    @bkonyi
    Contributor

    Totally thought I followed up on this, but I guess I didn't. This isn't related to dart-lang/sdk#22470 but is an issue with the wrapper scripts we have around the standalone Dart VM in the Flutter SDK. We should be execing the VM from within those wrappers, but instead we're spawning a child process. It's a rather simple fix IIRC.

  8. christopherfujino commented on Mar 8, 2022

    @christopherfujino
    Contributor

    Totally thought I followed up on this, but I guess I didn't. This isn't related to dart-lang/sdk#22470 but is an issue with the wrapper scripts we have around the standalone Dart VM in the Flutter SDK. We should be execing the VM from within those wrappers, but instead we're spawning a child process. It's a rather simple fix IIRC.

    Ahh cool

  9. christopherfujino commented on Mar 8, 2022

    @christopherfujino
    Contributor

    @gspencergoog any reason not to call exec from our bash entrypoints rather than spawning a subprocess for flutter and dart?

  10. gspencergoog commented on Mar 9, 2022

    @gspencergoog
    Contributor

    No, no reason at all. That's the right thing to do.

  11. darshankawar commented on Mar 9, 2022

    @darshankawar
    Member

    Labeling it as applicable based on the discussion / thread above.

  12. added
    engineflutter/engine related. See also e: labels.
    toolAffects the "flutter" command-line tool. See also t: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Mar 9, 2022
  13. christopherfujino commented on Mar 9, 2022

    @christopherfujino
    Contributor

    No, no reason at all. That's the right thing to do.

    cool, I can open a PR for that

  14. removed
    engineflutter/engine related. See also e: labels.
    on Mar 14, 2022
  15. added
    r: fixedIssue is closed as already fixed in a newer version
    on Mar 15, 2022
  16. github-actions commented on Mar 29, 2022

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  17. locked as resolved and limited conversation to collaborators on Mar 29, 2022
  18. slightfoot commented on Jun 10, 2022

    @slightfoot
    Member

    I can confirm this is still an issue on windows with the batch scripts used.

  19. maheshj01 commented on Jun 13, 2022

    @maheshj01
    Member

    @slightfoot Could you please file that as a separate issue? since this thread has been locked and limited to collaborators only.

  20. christopherfujino commented on Jun 13, 2022

    @christopherfujino
    Contributor

    I can confirm this is still an issue on windows with the batch scripts used.

    I agree with @maheshmnj, please file a new issue for that; this issue was specifically for bash entrypoint.

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

Metadata

Metadata

Labels

r: fixedIssue is closed as already fixed in a newer versiontoolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions