Skip to content

Flutter service extensions disabled after a hot-restart #8490

Closed as not planned

Description

@elliette

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!

Activity

  1. added
    P2important to work on, but not at the top of the work list.
    on Oct 29, 2024
  2. self-assigned this
    on Oct 29, 2024
  3. 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 [/+] on Oct 29, 2024
  4. kenzieschmoll commented on Oct 30, 2024

    @kenzieschmoll
    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.

  5. elliette commented on Nov 5, 2024

    @elliette
    MemberAuthor

    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.

  6. 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[/+] on Nov 5, 2024
  7. added
    P1high priority issues at the top of the work list, actively being worked on.
    and removed
    P2important to work on, but not at the top of the work list.
    on Nov 5, 2024
  8. elliette commented on Nov 5, 2024

    @elliette
    MemberAuthor

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

  9. bkonyi commented on Nov 6, 2024

    @bkonyi
    Contributor

    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.

  10. elliette commented on Nov 6, 2024

    @elliette
    MemberAuthor

    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.

  11. added
    P2important to work on, but not at the top of the work list.
    and removed
    P1high priority issues at the top of the work list, actively being worked on.
    on Nov 6, 2024
  12. johnpryan commented on Oct 22, 2026

    @johnpryan
    Contributor

    This has been marked as no longer reproducible and there hasn't been any further activity, closing.

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

Metadata

Metadata

Assignees

Labels

P2important to work on, but not at the top of the work list.reproduce to verifyIssues that need to be reproduced to verify that they still exist.type-test

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions