• Ben Konyi's avatar
    Reland "Fix issue where DevTools would not be immediately available when using... · 5ea2be69
    Ben Konyi authored
    Reland "Fix issue where DevTools would not be immediately available when using --start-paused (#126698)" (#129368)
    
    **Original Description:**
    
    > Service extensions are unable to handle requests when the isolate they
    were registered on is paused. The DevTools launcher logic was waiting
    for some service extension invocations to complete before advertising
    the already active DevTools instance, but when --start-paused was
    provided these requests would never complete, preventing users from
    using DevTools to resume the paused isolate.
    > 
    > Fixes https://github.com/flutter/flutter/issues/126691
    
    **Additional changes in this PR:**
    
    The failures listed in https://github.com/flutter/flutter/pull/128117
    appear to be related to a shutdown race. It's possible for the test to
    complete while the tool is in the process of starting and advertising
    DevTools, so we need to perform a check of `_shutdown` in
    `FlutterResidentDevtoolsHandler` before advertising DevTools.
    
    Before the original fix, this check was being performed immediately
    after invoking the service extensions, which creates an asynchronous gap
    in execution. With #126698, the callsite of the service extensions was
    moved and the `_shutdown` check wasn't, allowing for the tool to attempt
    to advertise DevTools after the DevTools server had been cleaned up.
    
    ---------
    Co-authored-by: 's avatarZachary Anderson <zanderso@users.noreply.github.com>
    5ea2be69
run_hot.dart 57.1 KB