mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:07:49 +00:00
[dds/dap] Attempt to fix flaky tests on Linux during shutdown while debugger is initializing
Fixes https://github.com/dart-lang/sdk/issues/50058. Change-Id: Ia0b498a4f1c943bc1f21f940c533584837ba5311 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261401 Reviewed-by: Ben Konyi <bkonyi@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
74b7248773
commit
17bd00df50
|
@ -7,6 +7,7 @@ import 'dart:convert';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:json_rpc_2/error_code.dart' as jsonRpcErrors;
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:vm_service/vm_service.dart' as vm;
|
||||
|
@ -2099,13 +2100,22 @@ abstract class DartDebugAdapter<TL extends LaunchRequestArguments,
|
|||
try {
|
||||
return await func();
|
||||
} on vm.RPCError catch (e) {
|
||||
// If we're been asked to shut down while this request was occurring,
|
||||
// it's normal to get kServiceDisappeared so we should handle this
|
||||
// silently.
|
||||
if (isTerminating && e.code == RpcErrorCodes.kServiceDisappeared) {
|
||||
return null;
|
||||
// If we've been asked to shut down while this request was occurring,
|
||||
// it's normal to get some types of errors from in-flight VM Service
|
||||
// requests and we should handle them silently.
|
||||
if (isTerminating) {
|
||||
// kServiceDisappeared is thrown sometimes when services disappear.
|
||||
if (e.code == RpcErrorCodes.kServiceDisappeared) {
|
||||
return null;
|
||||
}
|
||||
// SERVER_ERROR can occur when DDS completes any outstanding requests
|
||||
// with "The client closed with pending request".
|
||||
if (e.code == jsonRpcErrors.SERVER_ERROR) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, it's an unexpected/unknown failure and should be rethrown.
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -922,7 +922,11 @@ class ThreadInfo {
|
|||
// We can't leave dangling completers here because others may already
|
||||
// be waiting on them, so propagate the error to them.
|
||||
completers.forEach((uri, completer) => completer.completeError(e));
|
||||
rethrow;
|
||||
|
||||
// Don't rethrow here, because it will cause these completers futures
|
||||
// to not have error handlers attached which can cause their errors to
|
||||
// go unhandled. Instead, these completers futures will be returned
|
||||
// below and awaited by the caller (which will propogate the errors).
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue