Skip to content

Commit 31c3d09

Browse files
Do not cancel the VmService's subscription to the isolate event stream in FlutterVmService.findExtensionIsolate (#153607)
The stream subscriptions in the device's VmService are used by other parts of FlutterVmService and other components throughout flutter_tools. Components that listen to streams should not call VmService.streamCancel because that will interfere with other users who still want the events. See flutter/flutter#153049 See flutter/flutter#153563
1 parent bf5bcff commit 31c3d09

File tree

5 files changed

+1
-81
lines changed

5 files changed

+1
-81
lines changed

packages/flutter_tools/lib/src/vmservice.dart

-5
Original file line numberDiff line numberDiff line change
@@ -986,11 +986,6 @@ class FlutterVmService {
986986
throw VmServiceDisappearedException();
987987
} finally {
988988
await isolateEvents.cancel();
989-
try {
990-
await service.streamCancel(vm_service.EventStreams.kIsolate);
991-
} on vm_service.RPCError {
992-
// It's ok for cleanup to fail, such as when the service disappears.
993-
}
994989
}
995990
}
996991

packages/flutter_tools/test/general.shard/integration_test_device_test.dart

-6
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ void main() {
9696
'isolateId': '1',
9797
},
9898
),
99-
const FakeVmServiceRequest(
100-
method: 'streamCancel',
101-
args: <String, Object>{
102-
'streamId': 'Isolate',
103-
},
104-
),
10599
const FakeVmServiceRequest(
106100
method: 'streamListen',
107101
args: <String, Object>{

packages/flutter_tools/test/general.shard/resident_devtools_handler_test.dart

-32
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ void main() {
153153
'isolateId': '1',
154154
},
155155
),
156-
const FakeVmServiceRequest(
157-
method: 'streamCancel',
158-
args: <String, Object>{
159-
'streamId': 'Isolate',
160-
},
161-
),
162156
listViews,
163157
listViews,
164158
const FakeVmServiceRequest(
@@ -224,12 +218,6 @@ void main() {
224218
'isolateId': '1',
225219
},
226220
),
227-
const FakeVmServiceRequest(
228-
method: 'streamCancel',
229-
args: <String, Object>{
230-
'streamId': 'Isolate',
231-
},
232-
),
233221
const FakeVmServiceRequest(
234222
method: 'ext.flutter.activeDevToolsServerAddress',
235223
args: <String, Object>{
@@ -270,13 +258,6 @@ void main() {
270258
method: kListViewsMethod,
271259
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
272260
),
273-
const FakeVmServiceRequest(
274-
method: 'streamCancel',
275-
args: <String, Object>{
276-
'streamId': 'Isolate',
277-
},
278-
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
279-
),
280261
], httpAddress: Uri.parse('http://localhost:1234'));
281262

282263
final FakeFlutterDevice device = FakeFlutterDevice()
@@ -311,12 +292,6 @@ void main() {
311292
'isolateId': '1',
312293
},
313294
),
314-
const FakeVmServiceRequest(
315-
method: 'streamCancel',
316-
args: <String, Object>{
317-
'streamId': 'Isolate',
318-
},
319-
),
320295
listViews,
321296
listViews,
322297
const FakeVmServiceRequest(
@@ -346,13 +321,6 @@ void main() {
346321
method: kListViewsMethod,
347322
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
348323
),
349-
const FakeVmServiceRequest(
350-
method: 'streamCancel',
351-
args: <String, Object>{
352-
'streamId': 'Isolate',
353-
},
354-
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
355-
),
356324
], httpAddress: Uri.parse('http://localhost:5678'));
357325

358326
await handler.serveAndAnnounceDevTools(

packages/flutter_tools/test/general.shard/vmservice_test.dart

-37
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,6 @@ void main() {
535535
'isolateId': '1',
536536
},
537537
),
538-
const FakeVmServiceRequest(
539-
method: 'streamCancel',
540-
args: <String, Object>{
541-
'streamId': 'Isolate',
542-
},
543-
),
544538
]);
545539

546540
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
@@ -592,12 +586,6 @@ void main() {
592586
'isolateId': '2',
593587
},
594588
),
595-
const FakeVmServiceRequest(
596-
method: 'streamCancel',
597-
args: <String, Object>{
598-
'streamId': 'Isolate',
599-
},
600-
),
601589
]);
602590

603591
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(otherExtensionName);
@@ -644,12 +632,6 @@ void main() {
644632
isolate: isolate2,
645633
),
646634
),
647-
const FakeVmServiceRequest(
648-
method: 'streamCancel',
649-
args: <String, Object>{
650-
'streamId': 'Isolate',
651-
},
652-
),
653635
]);
654636

655637
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(otherExtensionName);
@@ -674,12 +656,6 @@ void main() {
674656
'isolateId': '1',
675657
},
676658
),
677-
const FakeVmServiceRequest(
678-
method: 'streamCancel',
679-
args: <String, Object>{
680-
'streamId': 'Isolate',
681-
},
682-
),
683659
]);
684660

685661
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
@@ -710,12 +686,6 @@ void main() {
710686
timestamp: 1,
711687
),
712688
),
713-
const FakeVmServiceRequest(
714-
method: 'streamCancel',
715-
args: <String, Object>{
716-
'streamId': 'Isolate',
717-
},
718-
),
719689
]);
720690

721691
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
@@ -734,13 +704,6 @@ void main() {
734704
method: kListViewsMethod,
735705
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
736706
),
737-
const FakeVmServiceRequest(
738-
method: 'streamCancel',
739-
args: <String, Object>{
740-
'streamId': 'Isolate',
741-
},
742-
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
743-
),
744707
]);
745708

746709
expect(

packages/flutter_tools/test/integration.shard/hot_reload_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void main() {
8181
});
8282

8383
testWithoutContext('hot restart works without error', () async {
84-
await flutter.run(verbose: true, noDevtools: true);
84+
await flutter.run(verbose: true);
8585
await flutter.hotRestart();
8686
});
8787

0 commit comments

Comments
 (0)