Fix forward_id stats for the centralized manager (#1454)

* Fix forward_id stats for the centralized manager

* Fix stats bug
This commit is contained in:
Andrea Fioraldi 2023-08-25 14:23:25 +02:00 committed by GitHub
parent 04c8d5208b
commit 760edbf0d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 7 deletions

View File

@ -644,10 +644,10 @@ where
input, input,
client_config, client_config,
exit_kind, exit_kind,
corpus_size: _, corpus_size,
observers_buf, observers_buf,
time: _, time,
executions: _, executions,
forward_id, forward_id,
} => { } => {
log::info!("Received new Testcase from {client_id:?} ({client_config:?}, forward {forward_id:?})"); log::info!("Received new Testcase from {client_id:?} ({client_config:?}, forward {forward_id:?})");
@ -659,9 +659,29 @@ where
postcard::from_bytes(observers_buf.as_ref().unwrap())?; postcard::from_bytes(observers_buf.as_ref().unwrap())?;
fuzzer.process_execution(state, self, input, &observers, &exit_kind, true)? fuzzer.process_execution(state, self, input, &observers, &exit_kind, true)?
} else { } else {
fuzzer.evaluate_input_with_observers::<E, Self>( let res = fuzzer.evaluate_input_with_observers::<E, Self>(
state, executor, self, input, true, state,
)? executor,
self,
input.clone(),
false,
)?;
if res.1.is_some() {
self.inner.fire(
state,
Event::NewTestcase {
input,
client_config,
exit_kind,
corpus_size,
observers_buf,
time,
executions,
forward_id,
},
)?;
}
res
}; };
if let Some(item) = res.1 { if let Some(item) = res.1 {
log::info!("Added received Testcase as item #{item}"); log::info!("Added received Testcase as item #{item}");

View File

@ -240,7 +240,11 @@ where
}; };
let client = monitor.client_stats_mut_for(id); let client = monitor.client_stats_mut_for(id);
client.update_corpus_size(*corpus_size as u64); client.update_corpus_size(*corpus_size as u64);
if id == client_id {
// do not update executions for forwarded messages, otherwise we loose the total order
// as a forwarded msg with a lower executions may arrive after a stats msg with an higher executions
client.update_executions(*executions as u64, *time); client.update_executions(*executions as u64, *time);
}
monitor.display(event.name().to_string(), id); monitor.display(event.name().to_string(), id);
Ok(BrokerEventResult::Forward) Ok(BrokerEventResult::Forward)
} }