Skip to content

Commit bd371e7

Browse files
authored
chore: EXC: Fix flaky monitor thread test (#4789)
1 parent 7575e49 commit bd371e7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

rs/canister_sandbox/src/replica_controller/sandboxed_execution_controller.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,9 +2530,9 @@ mod tests {
25302530
sandboxed_execution_controller_dir_and_path(active, spawn_monitor_thread);
25312531
add_controller_backends(&mut controller, 0, active, 0, 0);
25322532

2533-
// Trigger the monitoring and wait for the monitoring results.
2534-
let _ = controller.stop_monitoring_thread.send(false);
2535-
for _ in 0..10_000 {
2533+
for _ in 0..1_000 {
2534+
// Trigger the monitoring and wait for the monitoring results.
2535+
controller.stop_monitoring_thread.send(false).unwrap();
25362536
let stats = get_sandbox_process_stats(&controller.backends);
25372537
if stats[0].2.rss != DEFAULT_SANDBOX_PROCESS_RSS {
25382538
break;
@@ -2573,12 +2573,14 @@ mod tests {
25732573

25742574
add_controller_backends(&mut controller, 0, active, evicted, 0);
25752575

2576-
// Trigger the monitoring twice and wait for the monitoring results.
2577-
let _ = controller.stop_monitoring_thread.send(false);
2578-
let _ = controller.stop_monitoring_thread.send(false);
2579-
for _ in 0..10_000 {
2576+
for _ in 0..1_000 {
2577+
// Trigger the monitoring and wait for the monitoring results.
2578+
controller.stop_monitoring_thread.send(false).unwrap();
25802579
let m = &controller.metrics;
2581-
if m.sandboxed_execution_subprocess_anon_rss.get_sample_count() > 1 {
2580+
if m.sandboxed_execution_subprocess_active_last_used
2581+
.get_sample_count()
2582+
> 0
2583+
{
25822584
break;
25832585
}
25842586
thread::sleep(Duration::from_millis(10));

0 commit comments

Comments
 (0)