[vm, io] Skip global destructors when using dart:io's exit.

TEST=msan
Bug: https://github.com/dart-lang/sdk/issues/51271
Bug: https://github.com/dart-lang/sdk/issues/51560
Change-Id: Ie3a487656173790d48c41c272a131ce51f667a9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321921
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak 2023-08-22 16:24:40 +00:00 committed by Commit Queue
parent 3fb88e4c66
commit ef4984566b
5 changed files with 16 additions and 7 deletions

View file

@ -162,7 +162,10 @@ void Platform::SetProcessName(const char* name) {
void Platform::Exit(int exit_code) {
Console::RestoreConfig();
Dart_PrepareToAbort();
exit(exit_code);
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
// and other VM threads may be accessing state with global destructors, so
// we skip global destructors by using _exit instead of exit.
_exit(exit_code);
}
void Platform::SetCoreDumpResourceLimit(int value) {

View file

@ -157,7 +157,10 @@ void Platform::SetProcessName(const char* name) {
void Platform::Exit(int exit_code) {
Console::RestoreConfig();
Dart_PrepareToAbort();
exit(exit_code);
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
// and other VM threads may be accessing state with global destructors, so
// we skip global destructors by using _exit instead of exit.
_exit(exit_code);
}
void Platform::SetCoreDumpResourceLimit(int value) {

View file

@ -169,7 +169,10 @@ void Platform::SetProcessName(const char* name) {
void Platform::Exit(int exit_code) {
Console::RestoreConfig();
Dart_PrepareToAbort();
exit(exit_code);
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
// and other VM threads may be accessing state with global destructors, so
// we skip global destructors by using _exit instead of exit.
_exit(exit_code);
}
void Platform::SetCoreDumpResourceLimit(int value) {

View file

@ -342,7 +342,10 @@ void Platform::SetProcessName(const char* name) {
void Platform::Exit(int exit_code) {
Console::RestoreConfig();
Dart_PrepareToAbort();
exit(exit_code);
// We're not doing a full VM shutdown with Dart_Cleanup, which might block,
// and other VM threads may be accessing state with global destructors, so
// we skip global destructors by using _exit instead of exit.
_exit(exit_code);
}
void Platform::SetCoreDumpResourceLimit(int value) {

View file

@ -78,9 +78,6 @@ verbose_gc_to_bmu_test: Skip # Attempts to spawn dart using Platform.executable
[ $sanitizer == asan ]
io/process_detached_test: Slow, Pass
[ $sanitizer == msan ]
io/process_sync_test: Skip # Flaky from global destructors race - dartbug.com/51271
[ $sanitizer == tsan ]
io/https_client_certificate_test: Slow, Pass