Skip to content

Don't wait on stream listening in DevTools start up#3320

Merged
elliette merged 1 commit intoflutter:masterfrom
elliette:await-streams
Aug 31, 2021
Merged

Don't wait on stream listening in DevTools start up#3320
elliette merged 1 commit intoflutter:masterfrom
elliette:await-streams

Conversation

@elliette
Copy link
Member

We are currently awaiting setting up listeners on all the streams in the vmServiceOpened method. This can take ~300 ms to complete. I don't think it's necessary for us to block on getting the listeners registered.

Note: I've also opened dart-lang/sdk#47042 to investigate the weird throttling behavior I'm seeing on these requests.

@elliette elliette marked this pull request as ready for review August 31, 2021 16:38
@elliette elliette linked an issue Aug 31, 2021 that may be closed by this pull request
@elliette elliette merged commit c2114dd into flutter:master Aug 31, 2021
serviceStreamName,
];

await Future.wait(streamIds.map((String id) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the Future.wait as well. it isn't doing anything useful now that the result is unawaited.
This change could cause some tricky race conditions.
Main race condition: need to ensure that we are listening for isolate events before we fetch the isolate. Otherwise we could incorrectly believe the isolate is paused because we missed the resume event.
@bkonyi I know a lot of the streams now have history. If all the streams where race conditions matter are ones where we can fetch with history then we are safe.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh interesting! Unless I'm misunderstanding something, it looks like currently we are fetching the isolate before listening for the isolate events. (await isolateManager.init(isolates) is the call right before this call to start listening to the streams). Might make sense to send off the stream listen requests earlier.

elliette added a commit that referenced this pull request Aug 31, 2021
elliette added a commit that referenced this pull request Aug 31, 2021
elliette added a commit to elliette/devtools that referenced this pull request Sep 2, 2021
@elliette elliette deleted the await-streams branch December 24, 2021 00:24
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.

DevTools is slow to startup

3 participants