Skip to content

Commit e7f1b99

Browse files
committed
Don't retry infinitely many times on no output
Example output: ``` [2020-07-06T22:29:20Z WARN collector::execute] failed to deserialize stats, retrying (try 1); output: Output { status: ExitStatus(ExitStatus(0)), stdout: "", stderr: " Documenting issue-20936-deep-vector v0.1.0 (/tmp/.tmpeT8Qdq)\n Finished dev [unoptimized + debuginfo] target(s) in 1.25s\n" } [2020-07-06T22:29:21Z WARN collector::execute] failed to deserialize stats, retrying (try 2); output: Output { status: ExitStatus(ExitStatus(0)), stdout: "", stderr: " Documenting issue-20936-deep-vector v0.1.0 (/tmp/.tmpeT8Qdq)\n Finished dev [unoptimized + debuginfo] target(s) in 1.19s\n" } [2020-07-06T22:29:22Z WARN collector::execute] failed to deserialize stats, retrying (try 3); output: Output { status: ExitStatus(ExitStatus(0)), stdout: "", stderr: " Documenting issue-20936-deep-vector v0.1.0 (/tmp/.tmpeT8Qdq)\n Finished dev [unoptimized + debuginfo] target(s) in 1.21s\n" } [2020-07-06T22:29:23Z WARN collector::execute] failed to deserialize stats, retrying (try 4); output: Output { status: ExitStatus(ExitStatus(0)), stdout: "", stderr: " Documenting issue-20936-deep-vector v0.1.0 (/tmp/.tmpeT8Qdq)\n Finished dev [unoptimized + debuginfo] target(s) in 1.20s\n" } thread 'main' panicked at 'failed to collect statistics after 5 tries', collector/src/bin/rustc-perf-collector/execute.rs:568:21 ```
1 parent 7d819df commit e7f1b99

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

collector/src/bin/rustc-perf-collector/execute.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ pub struct MeasureProcessor<'a> {
399399
patched_incr_stats: Vec<(Patch, (Stats, Option<SelfProfile>))>,
400400
is_first_collection: bool,
401401
self_profile: bool,
402+
tries: u8,
402403
}
403404

404405
impl<'a> MeasureProcessor<'a> {
@@ -425,6 +426,7 @@ impl<'a> MeasureProcessor<'a> {
425426
is_first_collection: true,
426427
// Command::new("summarize").status().is_ok()
427428
self_profile,
429+
tries: 0,
428430
}
429431
}
430432

@@ -544,11 +546,17 @@ impl<'a> Processor for MeasureProcessor<'a> {
544546
Ok(Retry::No)
545547
}
546548
Err(DeserializeStatError::NoOutput(output)) => {
547-
log::warn!(
548-
"failed to deserialize stats, retrying; output: {:?}",
549-
output
550-
);
551-
Ok(Retry::Yes)
549+
if self.tries < 5 {
550+
log::warn!(
551+
"failed to deserialize stats, retrying (try {}); output: {:?}",
552+
self.tries,
553+
output
554+
);
555+
self.tries += 1;
556+
Ok(Retry::Yes)
557+
} else {
558+
panic!("failed to collect statistics after 5 tries");
559+
}
552560
}
553561
Err(e @ DeserializeStatError::ParseError { .. }) => {
554562
panic!("process_perf_stat_output failed: {:?}", e);

0 commit comments

Comments
 (0)