Skip to content
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

Flutter service extensions disabled after a hot-restart #8490

Open
elliette opened this issue Oct 29, 2024 · 5 comments
Open

Flutter service extensions disabled after a hot-restart #8490

elliette opened this issue Oct 29, 2024 · 5 comments
Assignees
Labels
P2 important to work on, but not at the top of the work list. testing

Comments

@elliette
Copy link
Member

I noticed that if you start a test with a connection to a live app, trigger a hot-restart, and then try to call a service extension from Flutter, the test will fail because the service extension is never re-registered.

I'm pretty sure this is the same underlying cause as #7313, when DWDS was connecting directly to the VM Service URI instead of the DDS URI.

Because DDS intercepts the streamListen request and sends back all of the service extensions it is aware of, these service extensions are never sent back to the DevTools test infra VM service connection.

Here is the code we will likely need to modify (where we get the VM service URI and connect to it):

final debugPort =
await waitFor(event: 'app.debugPort', timeout: appStartTimeout);
final Map<String, dynamic> params = debugPort['params'];
final String wsUriString = params['wsUri'];
_vmServiceWsUri = Uri.parse(wsUriString);
// Map to WS URI.
_vmServiceWsUri =
convertToWebSocketUrl(serviceProtocolUrl: _vmServiceWsUri);
vmService = await vmServiceConnectUriWithFactory<VmServiceWrapper>(
_vmServiceWsUri.toString(),
vmServiceFactory: ({
// ignore: avoid-dynamic, mirrors types of [VmServiceFactory].
required Stream<dynamic> /*String|List<int>*/ inStream,
required void Function(String message) writeMessage,
Log? log,
DisposeHandler? disposeHandler,
Future? streamClosed,
String? wsUri,
bool trackFutures = false,
}) =>
VmServiceWrapper.defaultFactory(
inStream: inStream,
writeMessage: writeMessage,
log: log,
disposeHandler: disposeHandler,
streamClosed: streamClosed,
wsUri: wsUri,
trackFutures: true,
),
);

@bkonyi Do you happen to know how we could get the DDS URI here instead? Thanks!

@elliette elliette added testing P2 important to work on, but not at the top of the work list. labels Oct 29, 2024
@elliette elliette self-assigned this Oct 29, 2024
@elliette elliette changed the title Tests running with a live app looses Flutter service extensions after a hot-restart Tests running with a live app lose Flutter service extensions after a hot-restart Oct 29, 2024
@kenzieschmoll
Copy link
Member

This may not be just a testing only issue. I noticed that the Performance Overlay button on the performance page becomes disabled after a hot restart, indicating that we are not getting the service extension event registered event after a hot restart is performed.

@elliette
Copy link
Member Author

elliette commented Nov 5, 2024

I just saw this too, not while running tests. This seems to be more widespread - we are losing the Flutter service extensions after a hot-restart.

@elliette elliette changed the title Tests running with a live app lose Flutter service extensions after a hot-restart Flutter service extensions disabled after a hot-restart Nov 5, 2024
@elliette elliette added P1 high priority issues at the top of the work list, actively being worked on. and removed P2 important to work on, but not at the top of the work list. labels Nov 5, 2024
@elliette
Copy link
Member Author

elliette commented Nov 5, 2024

If I run an app with --no-dds, the Flutter service extensions are re-registered on hot-restart.

@bkonyi
Copy link
Contributor

bkonyi commented Nov 6, 2024

Just to clarify, service extensions registered using dart:developer don't actually result in ServiceRegistered events being sent on the Service stream, but ServiceExtensionAdded events on the Isolate stream.

@elliette
Copy link
Member Author

elliette commented Nov 6, 2024

I haven't been able to reproduce this anymore. I'm lowering this to P2, but if I encounter it again I will investigate more.

@elliette elliette added P2 important to work on, but not at the top of the work list. and removed P1 high priority issues at the top of the work list, actively being worked on. labels Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 important to work on, but not at the top of the work list. testing
Projects
None yet
Development

No branches or pull requests

3 participants