这是indexloc提供的服务,不要输入任何密码
Skip to content

Fix issue where DevTools would not be immediately available when using --start-paused #126698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 1, 2023

Conversation

bkonyi
Copy link
Contributor

@bkonyi bkonyi commented May 12, 2023

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 #126691

…g --start-paused

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 #126691
@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label May 12, 2023
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@bkonyi bkonyi marked this pull request as draft May 12, 2023 18:10
Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

This looks reasonable, can you add a test?

@bkonyi
Copy link
Contributor Author

bkonyi commented May 12, 2023

This looks reasonable, can you add a test?

That's the plan, I just wanted to make sure the existing checks didn't blow up first.

Copy link
Member

@kenzieschmoll kenzieschmoll left a comment

Choose a reason for hiding this comment

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

LGTM, though we should find a way to test this so that it does not regress.

@github-actions github-actions bot removed the tool Affects the "flutter" command-line tool. See also t: labels. label May 24, 2023
@bkonyi bkonyi marked this pull request as ready for review May 24, 2023 19:46
@bkonyi
Copy link
Contributor Author

bkonyi commented May 24, 2023

Sorry for the delay on this, totally forgot I had this draft. I've gone ahead and added a regression test so this is ready for review (FYI @christopherfujino).

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

LGTM

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label May 24, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 24, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented May 24, 2023

auto label is removed for flutter/flutter, pr: 126698, due to - The status or check suite Linux analyze has failed. Please fix the issues identified (or deflake) before re-applying this label.

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label May 24, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 24, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented May 24, 2023

auto label is removed for flutter/flutter, pr: 126698, due to - The status or check suite Mac tool_integration_tests_4_4 has failed. Please fix the issues identified (or deflake) before re-applying this label.

@@ -116,6 +112,10 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
// report their URLs yet. Do so now.
_residentRunner.printDebuggerList(includeVmService: false);
}

final List<FlutterDevice?> devicesWithExtension = await _devicesWithExtensions(flutterDevices);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simply moving this seems to cause a race condition in flutter error messages include a DevTools link in test/integration.shard/overall_experience_test.dart. The test relies on the DevTools message to trigger a hot reload, which causes an overflow error that includes the DevTools URI. Unfortunately, the DevTools URI can only be output after the service extensions here have finished executing. Unless we want to put a delay in the test logic, we'll need to handle the --start-paused case separately here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@christopherfujino can you take a look at the updated changes when you have a chance?

@bkonyi bkonyi added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@goderbauer goderbauer added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 1, 2023
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jun 1, 2023

auto label is removed for flutter/flutter, pr: 126698, Mergeability of pull request flutter/flutter/126698 could not be determined at time of merge..

@christopherfujino christopherfujino added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 1, 2023
@auto-submit auto-submit bot merged commit 35174cc into master Jun 1, 2023
@auto-submit auto-submit bot deleted the fix_devtools_start_paused branch June 1, 2023 22:35
zanderso added a commit that referenced this pull request Jun 2, 2023
zanderso added a commit that referenced this pull request Jun 2, 2023
…hen using --start-paused" (#128117)

Reverts #126698

There are a bunch of tool crashes on CI that start with this commit. I'm
not sure this PR is the cause because there is no backtrace from the
tool on the crashes. The only error message is `Oops; flutter has exited
unexpectedly: "Null check operator used on a null value`.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 3, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jun 5, 2023
Roll Flutter from 3db9504 to 0b74153 (108 revisions)

flutter/flutter@3db9504...0b74153

2023-06-03 engine-flutter-autoroll@skia.org Roll Flutter Engine from 54293721816a to c838a1b05924 (2 revisions) (flutter/flutter#128161)
2023-06-03 engine-flutter-autoroll@skia.org Roll Flutter Engine from 8769e9ce3a90 to 54293721816a (8 revisions) (flutter/flutter#128158)
2023-06-03 goderbauer@google.com Prefix for dart:ui multiview change (flutter/flutter#128152)
2023-06-02 aam@google.com Roll dds dependency to 2.8.3 for expression evaluation upcoming fixes. (flutter/flutter#128124)
2023-06-02 engine-flutter-autoroll@skia.org Roll Flutter Engine from f3f6a020595d to 8769e9ce3a90 (3 revisions) (flutter/flutter#128149)
2023-06-02 engine-flutter-autoroll@skia.org Roll Flutter Engine from b4250acbf3ca to f3f6a020595d (3 revisions) (flutter/flutter#128147)
2023-06-02 flar@google.com Reland "Remove obsolete drawShadow bounds workaround (#127052)" (flutter/flutter#127231)
2023-06-02 engine-flutter-autoroll@skia.org Roll Flutter Engine from c6e9383f2143 to b4250acbf3ca (8 revisions) (flutter/flutter#128142)
2023-06-02 goderbauer@google.com Pre-migration for dart:ui multi view changes (flutter/flutter#128092)
2023-06-02 goderbauer@google.com Remove LiveTestRenderView (flutter/flutter#127882)
2023-06-02 engine-flutter-autoroll@skia.org Roll Flutter Engine from 02d6fbb68b69 to c6e9383f2143 (15 revisions) (flutter/flutter#128119)
2023-06-02 5236035+fzyzcjy@users.noreply.github.com Tiny remove unnecessary method in text_selection.dart (flutter/flutter#127480)
2023-06-02 vashworth@google.com Workaround for Dart VM timeout (flutter/flutter#127875)
2023-06-02 goderbauer@google.com Make --flutter-repo analyze whole repo (flutter/flutter#127990)
2023-06-02 engine-flutter-autoroll@skia.org Roll Packages from f0513ae to 75085ed (3 revisions) (flutter/flutter#128121)
2023-06-02 50433979+natsuk4ze@users.noreply.github.com [Refactor] fix quote style in template (flutter/flutter#127762)
2023-06-02 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3a453f2ccb77 to 02d6fbb68b69 (14 revisions) (flutter/flutter#128089)
2023-06-02 goderbauer@google.com Fix typos in labels (flutter/flutter#128093)
2023-06-02 zanderso@users.noreply.github.com Revert "Fix issue where DevTools would not be immediately available when using --start-paused" (flutter/flutter#128117)
2023-06-02 goderbauer@google.com Sync Lints (flutter/flutter#127976)
2023-06-02 hans.muller@gmail.com Updated TabBar and ToggleButtons examples (flutter/flutter#128088)
2023-06-02 36861262+QuncCccccc@users.noreply.github.com Text should still be centered when search bar height is less than 48 (flutter/flutter#128068)
2023-06-02 fluttergithubbot@gmail.com Roll pub packages (flutter/flutter#128053)
2023-06-01 tessertaha@gmail.com Add `FilterChip.elevated`, `ChoiceChip.elevated`, & `ActionChip.elevated` variants (flutter/flutter#128049)
2023-06-01 hans.muller@gmail.com Updated custom ListTile examples (flutter/flutter#128071)
2023-06-01 bkonyi@google.com Fix issue where DevTools would not be immediately available when using --start-paused (flutter/flutter#126698)
2023-06-01 katelovett@google.com Add error message when sliver overlap absorber is missing (flutter/flutter#128075)
2023-06-01 hans.muller@gmail.com Updated Menu examples (flutter/flutter#128080)
2023-06-01 5236035+fzyzcjy@users.noreply.github.com Add retry flag to flutter_test (flutter/flutter#125851)
2023-06-01 christopherfujino@gmail.com [flutter_tools] Use process matcher for multidex test (flutter/flutter#127996)
2023-06-01 hans.muller@gmail.com Updated InputDecoratorExamples for M3 (flutter/flutter#128065)
2023-06-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7c0a639efd0a to 3a453f2ccb77 (1 revision) (flutter/flutter#128064)
2023-06-01 christopherfujino@gmail.com migrate the package_autoroller from querying by label to title (flutter/flutter#128066)
2023-06-01 hans.muller@gmail.com Revised Floating Action Button examples (flutter/flutter#128058)
2023-06-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from fdd39c421fb9 to 7c0a639efd0a (2 revisions) (flutter/flutter#128056)
2023-06-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from c8e1a8d6fb57 to fdd39c421fb9 (1 revision) (flutter/flutter#128050)
2023-06-01 chillers@google.com [labeler] Remove use of any (flutter/flutter#128011)
2023-06-01 jonahwilliams@google.com [framework] remove reference to closed issue. (flutter/flutter#128007)
2023-06-01 engine-flutter-autoroll@skia.org Roll Packages from 95bb793 to f0513ae (3 revisions) (flutter/flutter#128045)
2023-06-01 vasilich6107@users.noreply.github.com Add fallback font to IconData class (flutter/flutter#127269)
2023-06-01 mdebbar@google.com [web] Assert route names start with / if using PathUrlStrategy (flutter/flutter#127986)
2023-06-01 andrewrkolos@gmail.com [tool] In `flutter doctor -v`, warn when Android Studio version could not be detected. (flutter/flutter#126395)
2023-06-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from 8339c71a963c to c8e1a8d6fb57 (1 revision) (flutter/flutter#128035)
2023-06-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from bc81133892a6 to 8339c71a963c (1 revision) (flutter/flutter#128034)
2023-06-01 engine-flutter-autoroll@skia.org Roll Flutter Engine from e235f47164fa to bc81133892a6 (1 revision) (flutter/flutter#128026)
2023-06-01 72562119+tgucio@users.noreply.github.com Fixes in Cupertino translations (flutter/flutter#127872)
...
bkonyi added a commit that referenced this pull request Jun 27, 2023
…hen 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 #126691

**Additional changes in this PR:**

The failures listed in #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: Zachary Anderson <zanderso@users.noreply.github.com>
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DevTools started late when running flutter run with --start-paused
4 participants