Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Better logging of failure in the task_logger #2940

Merged
merged 7 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/agent/onefuzz-agent/src/validations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ async fn validate_libfuzzer(config: ValidationConfig) -> Result<()> {
let libfuzzer = LibFuzzer::new(
&config.target_exe,
config.target_options.clone(),
config.target_env.into_iter().collect(),
config.target_env.iter().cloned().collect(),
config
.setup_folder
.unwrap_or(config.target_exe.parent().unwrap().to_path_buf()),
.clone()
.unwrap_or_else(|| config.target_exe.parent().unwrap().to_path_buf()),
chkeita marked this conversation as resolved.
Show resolved Hide resolved
None::<&PathBuf>,
MachineIdentity {
machine_id: Uuid::nil(),
Expand Down Expand Up @@ -103,10 +104,11 @@ async fn get_logs(config: ValidationConfig) -> Result<()> {
let libfuzzer = LibFuzzer::new(
&config.target_exe,
config.target_options.clone(),
config.target_env.into_iter().collect(),
config.target_env.iter().cloned().collect(),
config
.setup_folder
.unwrap_or(config.target_exe.parent().unwrap().to_path_buf()),
.clone()
.unwrap_or_else(|| config.target_exe.parent().unwrap().to_path_buf()),
None::<&PathBuf>,
MachineIdentity {
machine_id: Uuid::nil(),
Expand Down
9 changes: 6 additions & 3 deletions src/agent/onefuzz-task/src/tasks/task_logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,8 @@ impl TaskLogger {
}) => break,
Ok(c) => c,
Err(e) => {
error!("{}", e);
break;
error!("task logger failure {}", e);
return Err(e);
}
};
}
Expand All @@ -440,7 +440,10 @@ pub struct SpawnedLogger {

impl SpawnedLogger {
pub async fn flush_and_stop(self, timeout: Duration) -> Result<()> {
let _ = tokio::time::timeout(timeout, self.logger_handle).await;
if let Ok(Err(e)) = tokio::time::timeout(timeout, self.logger_handle).await {
error!("task logger failure {}", e);
chkeita marked this conversation as resolved.
Show resolved Hide resolved
return Err(e.into());
}
Ok(())
}
}
Expand Down