[CFE] Probable 'fix' for weekly bot spradicly failing because of connection error when the process exits
E.g. weekly bot run
176 failed with "getIsolate: (112) Service has disappeared" among other things this.
173 failed with "getIsolate: (112) Service has disappeared".
172 failed with "getIsolate: (112) Service has disappeared".
168 failed with "[Sentinel kind: Collected, valueAsString: <collected>] from getIsolate()".
This will probably fix such issues, although I haven't been able to
reproduce them so I can't be certain.
Change-Id: I3fae76c6031d1a9dbf495e12412f4f95e567c6fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345304
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
diff --git a/pkg/front_end/test/vm_service_heap_helper.dart b/pkg/front_end/test/vm_service_heap_helper.dart
index 087096a..66322d7 100644
--- a/pkg/front_end/test/vm_service_heap_helper.dart
+++ b/pkg/front_end/test/vm_service_heap_helper.dart
@@ -69,6 +69,14 @@
return false;
}
+ bool _processHasExited = false;
+
+ @override
+ void processExited(int exitCode) {
+ super.processExited(exitCode);
+ _processHasExited = true;
+ }
+
@override
Future<void> run() async {
_vm = await serviceClient.getVM();
@@ -94,7 +102,17 @@
if (timeout != null) {
f = f.timeout(new Duration(seconds: timeout!));
}
- await f;
+ try {
+ await f;
+ } catch (e) {
+ await Future.delayed(const Duration(seconds: 2));
+ if (_processHasExited) {
+ // Seems OK for it to have thrown when the process exited
+ break;
+ }
+ // Process is still alive so don't swallow the throw.
+ rethrow;
+ }
}
print("Iteration: #$_iterationNumber");