-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[io] Exit the isolate during Process.runSync and sleep.
This prevents such an isolate from occupying one of the limited number of mutator slots and blocking other isolates in the same group from running. TEST=ci Bug: #51254 Bug: #54687 Bug: #57119 Change-Id: Ic04bbaa7f482d533ad0ecf2c6da17ea9f00c264e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/398927 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
- Loading branch information
1 parent
6f992ae
commit 322baef
Showing
7 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
runtime/tests/vm/dart/isolates/many_isolates_blocked_at_process_run_sync_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "dart:isolate"; | ||
import "dart:io"; | ||
|
||
child(replyPort) { | ||
replyPort.send(null); | ||
Process.runSync("sleep", ["3600"]); | ||
} | ||
|
||
main() async { | ||
var pending = 0; | ||
var port; | ||
port = new RawReceivePort((msg) { | ||
pending--; | ||
if (pending == 0) exit(0); | ||
}); | ||
|
||
for (var i = 0; i < 20; i++) { | ||
Isolate.spawn(child, port.sendPort); | ||
pending++; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
runtime/tests/vm/dart/isolates/many_isolates_blocked_at_sleep_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import "dart:isolate"; | ||
import "dart:io"; | ||
|
||
child(replyPort) { | ||
replyPort.send(null); | ||
sleep(Duration(minutes: 60)); | ||
} | ||
|
||
main() async { | ||
var pending = 0; | ||
var port; | ||
port = new RawReceivePort((msg) { | ||
pending--; | ||
if (pending == 0) exit(0); | ||
}); | ||
|
||
for (var i = 0; i < 20; i++) { | ||
Isolate.spawn(child, port.sendPort); | ||
pending++; | ||
} | ||
} |