Skip to content

Commit b3c579d

Browse files
derekxu16Commit Queue
authored andcommitted
Revert "Reland "[VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization""
This reverts commit c2095cb. Reason for revert: These changes are blocking the Dart SDK -> Flutter roll because they cause some Fuchsia tests to fail. Original change's description: > Reland "[VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization" > > This reverts commit d510876. > > Reason for revert: g3 and Golem have been made compatible with this CL. > See b/409535026 and > https://chrome-internal-review.googlesource.com/c/golem/+/8345341. > > TEST=pkg/vm_service/test/failure_to_start_vm_service_after_vm_is_initialized_test, > pkg/vm_service/test/failure_to_start_vm_service_during_vm_initialization_test > > Original change's description: > > Revert "[VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization" > > > > This reverts commit 56ccf43. > > > > Reason for revert: b/409535026 > > > > TEST=ci > > > > Original change's description: > > > [VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization > > > > > > TEST=pkg/vm_service/test/failure_to_start_vm_service_after_vm_is_initialized_test, > > > pkg/vm_service/test/failure_to_start_vm_service_during_vm_initialization_test > > > > > > Fixes: #60256 > > > Change-Id: I0543ab26e5721a4048136f27e8f4429bef04920f > > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416300 > > > Commit-Queue: Derek Xu <[email protected]> > > > Reviewed-by: Ben Konyi <[email protected]> > > > > Change-Id: I61eb42f0f00ad97e95e3ebf19990fe75d2d416aa > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421622 > > Reviewed-by: Derek Xu <[email protected]> > > Commit-Queue: Ivan Inozemtsev <[email protected]> > > Reviewed-by: Ben Konyi <[email protected]> > > Change-Id: Ieba880b7b298e491055c3f6049bab6772b1f8aa3 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434960 > Reviewed-by: Ben Konyi <[email protected]> > Commit-Queue: Derek Xu <[email protected]> No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: I03b2371728de91e4e20008a879280c1ccab4d07c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435540 Reviewed-by: Alexander Markov <[email protected]> Bot-Commit: Rubber Stamper <[email protected]> Commit-Queue: Derek Xu <[email protected]>
1 parent b0f933f commit b3c579d

File tree

7 files changed

+50
-285
lines changed

7 files changed

+50
-285
lines changed

pkg/pkg.status

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ vm_service/test/enhanced_enum_test: SkipByDesign # Debugger is disabled in AOT m
139139
vm_service/test/eval_*test: SkipByDesign # Debugger is disabled in AOT mode.
140140
vm_service/test/evaluate_*test: SkipByDesign # Debugger is disabled in AOT mode.
141141
vm_service/test/external_compilation_service_test: SkipByDesign # Spawns a secondary process.
142-
vm_service/test/failure_to_start_vm_service_after_vm_is_initialized_test: SkipByDesign # Spawns a child process from source, and the codepath under test is the same in JIT and AOT.
143-
vm_service/test/failure_to_start_vm_service_during_vm_initialization_test: SkipByDesign # Spawns a child process from source, and the codepath under test is the same in JIT and AOT.
144142
vm_service/test/field_script_test: SkipByDesign # Debugger is disabled in AOT mode.
145143
vm_service/test/forward_compile_expression_error_from_external_client_with_dds_test: SkipByDesign # Debugger is disabled in AOT mode.
146144
vm_service/test/forward_compile_expression_error_from_external_client_without_dds_test: SkipByDesign # Debugger is disabled in AOT mode.
@@ -193,7 +191,7 @@ vm_service/test/regress_45684_test: SkipByDesign # Debugger is disabled in AOT m
193191
vm_service/test/regress_46419_test: SkipByDesign # Debugger is disabled in AOT mode.
194192
vm_service/test/regress_46559_test: SkipByDesign # Debugger is disabled in AOT mode.
195193
vm_service/test/regress_48279_test: SkipByDesign # Debugger is disabled in AOT mode.
196-
vm_service/test/regress_55559_test: SkipByDesign # Spawns a child process from source, and the codepath under test is the same in JIT and AOT.
194+
vm_service/test/regress_55559_test: SkipByDesign # Spawns a child process from source.
197195
vm_service/test/regress_60396_test: SkipByDesign # Debugger is disabled in AOT mode.
198196
vm_service/test/regress_88104_test: SkipByDesign # Debugger is disabled in AOT mode.
199197
vm_service/test/reload_sources_rpc_triggers_isolate_reload_event_test: SkipByDesign # Hot reload is disabled in AOT mode.

pkg/vm_service/test/common/utils.dart

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,10 @@ import 'dart:convert';
66
import 'dart:io';
77

88
// TODO(bkonyi): Share this logic with _ServiceTesteeRunner.launch.
9-
Future<(Process, Uri?)> spawnDartProcess(
9+
Future<(Process, Uri)> spawnDartProcess(
1010
String script, {
11-
bool enableDds = true,
12-
int vmServicePort = 0,
13-
14-
/// If true, the second element in the returned record will be a [Uri] that
15-
/// can be used to connect to the VM Service running on the testee. If false,
16-
/// the second element in the returned record will be null.
17-
bool returnServiceUri = true,
1811
bool serveObservatory = true,
19-
required bool pauseOnStart,
20-
required bool pauseOnExit,
12+
bool pauseOnStart = true,
2113
bool disableServiceAuthCodes = false,
2214
bool subscribeToStdio = true,
2315
}) async {
@@ -27,18 +19,16 @@ Future<(Process, Uri?)> spawnDartProcess(
2719
final serviceInfoFile = await File.fromUri(serviceInfoUri).create();
2820

2921
final arguments = [
30-
if (!enableDds) '--no-dds',
31-
'--observe=$vmServicePort',
22+
'--no-dds',
23+
'--observe=0',
3224
if (!serveObservatory) '--no-serve-observatory',
3325
if (pauseOnStart) '--pause-isolates-on-start',
34-
if (pauseOnExit) '--pause-isolates-on-exit',
3526
if (disableServiceAuthCodes) '--disable-service-auth-codes',
3627
'--write-service-info=$serviceInfoUri',
3728
...Platform.executableArguments,
3829
Platform.script.resolve(script).toString(),
3930
];
4031
final process = await Process.start(executable, arguments);
41-
4232
if (subscribeToStdio) {
4333
process.stdout
4434
.transform(utf8.decoder)
@@ -47,11 +37,6 @@ Future<(Process, Uri?)> spawnDartProcess(
4737
.transform(utf8.decoder)
4838
.listen((line) => print('TESTEE ERR: $line'));
4939
}
50-
51-
if (!returnServiceUri) {
52-
return (process, null);
53-
}
54-
5540
while ((await serviceInfoFile.length()) <= 5) {
5641
await Future.delayed(const Duration(milliseconds: 50));
5742
}

pkg/vm_service/test/failure_to_start_vm_service_after_vm_is_initialized_test.dart

Lines changed: 0 additions & 92 deletions
This file was deleted.

pkg/vm_service/test/failure_to_start_vm_service_during_vm_initialization_test.dart

Lines changed: 0 additions & 72 deletions
This file was deleted.

pkg/vm_service/test/regress_55559_test.dart

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,10 @@ void main() {
3030
}
3131

3232
setUp(() async {
33-
final spawnDartProcessResult = await spawnDartProcess(
33+
state = await spawnDartProcess(
3434
'regress_55559_script.dart',
35-
enableDds: false,
3635
pauseOnStart: false,
37-
pauseOnExit: false,
3836
);
39-
40-
if (spawnDartProcessResult case (final Process process, final Uri uri)) {
41-
state = (process, uri);
42-
} else {
43-
fail(
44-
"The implementation of spawnDartProcess's returnServiceUri parameter"
45-
'is incorrect',
46-
);
47-
}
4837
});
4938

5039
tearDown(() {

sdk/lib/_internal/vm/bin/vmservice_io.dart

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -220,35 +220,13 @@ Future<List<Map<String, dynamic>>> listFilesCallback(Uri dirPath) async {
220220

221221
Uri? serverInformationCallback() => server.serverAddress;
222222

223-
/// Thrown when either the VM Service HTTP server or DDS fails to start.
224-
class _StartupException implements Exception {
225-
final String message;
226-
227-
_StartupException(this.message);
228-
}
229-
230-
/// Toggles the running state of the VM Service HTTP server. If
231-
/// [server._waitForDdsToAdvertiseService] is true, toggles DDS alongside the VM
232-
/// Service HTTP server.
233-
///
234-
/// Logs error messages to stderr and completes the returned [Future] with
235-
/// [false] if an attempt is made to enable the VM Service HTTP server or DDS
236-
/// and the attempt fails. Completes the returned [Future] with [true]
237-
/// otherwise.
238-
Future<bool> _toggleWebServer() async {
223+
Future<void> _toggleWebServer() async {
239224
// Toggle HTTP server.
240225
if (server.running) {
241226
await server.shutdown(true);
242227
await VMService().clearState();
243-
return true;
244228
} else {
245-
try {
246-
await server.startup();
247-
return true;
248-
} on _StartupException catch (e) {
249-
stderr.writeln(e.message);
250-
return false;
251-
}
229+
await server.startup();
252230
}
253231
}
254232

@@ -284,7 +262,7 @@ void _registerSignalHandler() {
284262
}
285263
_signalSubscription = signalWatch(
286264
ProcessSignal.sigquit,
287-
).listen((_) => unawaited(_toggleWebServer()));
265+
).listen((_) => _toggleWebServer());
288266
}
289267

290268
@pragma('vm:entry-point', !bool.fromEnvironment('dart.vm.product'))
@@ -319,13 +297,7 @@ void main() {
319297
);
320298

321299
if (_autoStart) {
322-
unawaited(
323-
_toggleWebServer().then((wasSuccessful) {
324-
if (!wasSuccessful) {
325-
exit(vmErrorExitCode);
326-
}
327-
}),
328-
);
300+
_toggleWebServer();
329301
}
330302
_registerSignalHandler();
331303
}

0 commit comments

Comments
 (0)