Unverified Commit 62171dfe authored by Anna Gringauze's avatar Anna Gringauze Committed by GitHub

Fix hot restart flake (#122776)

parent 96f927fb
......@@ -1019,7 +1019,10 @@ class FlutterVmService {
onError: (Object? error, StackTrace stackTrace) {
if (error is vm_service.SentinelException ||
error == null ||
(error is vm_service.RPCError && error.code == RPCErrorCodes.kServiceDisappeared)) {
error is vm_service.RPCError &&
(error.code == RPCErrorCodes.kServiceDisappeared ||
error.code == RPCErrorCodes.kInternalError &&
error.message.contains('Sentinel kind: Collected'))) {
return null;
}
return Future<vm_service.Isolate?>.error(error, stackTrace);
......
......@@ -45,6 +45,20 @@ Future<void> _testProject(HotReloadProject project, {String name = 'Default'}) a
await flutter.hotRestart();
});
testWithoutContext('$testName: hot restart works without error after delay', () async {
flutter.stdout.listen(printOnFailure);
await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose', '--web-renderer=html']);
await Future<void>.delayed(const Duration(milliseconds: 200));
await flutter.hotRestart();
});
testWithoutContext('$testName: multiple hot restarts work without error', () async {
flutter.stdout.listen(printOnFailure);
await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose', '--web-renderer=html']);
await Future<void>.delayed(const Duration(milliseconds: 200));
await Future.wait(<Future<void>>[ flutter.hotRestart(), flutter.hotRestart()]);
});
testWithoutContext('$testName: newly added code executes during hot restart', () async {
final Completer<void> completer = Completer<void>();
final StreamSubscription<String> subscription = flutter.stdout.listen((String line) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment