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 https://github.com/flutter/flutter/issues/153049
See https://github.com/flutter/flutter/issues/153563
This commit is contained in:
Jason Simmons 2024-08-19 10:40:07 -07:00 committed by GitHub
parent bf5bcff0c2
commit 31c3d0927b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 1 additions and 81 deletions

View File

@ -986,11 +986,6 @@ class FlutterVmService {
throw VmServiceDisappearedException();
} finally {
await isolateEvents.cancel();
try {
await service.streamCancel(vm_service.EventStreams.kIsolate);
} on vm_service.RPCError {
// It's ok for cleanup to fail, such as when the service disappears.
}
}
}

View File

@ -96,12 +96,6 @@ void main() {
'isolateId': '1',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
const FakeVmServiceRequest(
method: 'streamListen',
args: <String, Object>{

View File

@ -153,12 +153,6 @@ void main() {
'isolateId': '1',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
listViews,
listViews,
const FakeVmServiceRequest(
@ -224,12 +218,6 @@ void main() {
'isolateId': '1',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
const FakeVmServiceRequest(
method: 'ext.flutter.activeDevToolsServerAddress',
args: <String, Object>{
@ -270,13 +258,6 @@ void main() {
method: kListViewsMethod,
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
], httpAddress: Uri.parse('http://localhost:1234'));
final FakeFlutterDevice device = FakeFlutterDevice()
@ -311,12 +292,6 @@ void main() {
'isolateId': '1',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
listViews,
listViews,
const FakeVmServiceRequest(
@ -346,13 +321,6 @@ void main() {
method: kListViewsMethod,
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
], httpAddress: Uri.parse('http://localhost:5678'));
await handler.serveAndAnnounceDevTools(

View File

@ -535,12 +535,6 @@ void main() {
'isolateId': '1',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
@ -592,12 +586,6 @@ void main() {
'isolateId': '2',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(otherExtensionName);
@ -644,12 +632,6 @@ void main() {
isolate: isolate2,
),
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(otherExtensionName);
@ -674,12 +656,6 @@ void main() {
'isolateId': '1',
},
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
@ -710,12 +686,6 @@ void main() {
timestamp: 1,
),
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
),
]);
final vm_service.IsolateRef isolateRef = await fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName);
@ -734,13 +704,6 @@ void main() {
method: kListViewsMethod,
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
const FakeVmServiceRequest(
method: 'streamCancel',
args: <String, Object>{
'streamId': 'Isolate',
},
error: FakeRPCError(code: RPCErrorCodes.kServiceDisappeared),
),
]);
expect(

View File

@ -81,7 +81,7 @@ void main() {
});
testWithoutContext('hot restart works without error', () async {
await flutter.run(verbose: true, noDevtools: true);
await flutter.run(verbose: true);
await flutter.hotRestart();
});