Skip to content

Commit 6939851

Browse files
authored
Crash exporter if block processor task crashes (#4900)
## Motivation Right now, if the block processor returns an error, since we await the service first, we'll never see that error unless the service receives some shutdown signal or itself finishes for some reason, which in most cases doesn't happen. If the block processor returns an error, we should see that error and propagate it, even if the service is still running and receiving notifications. ## Proposal poll both futures at once with `select!` so that if the block processor returns an error, we can panic as we should ## Test Plan TBD
1 parent 8c87862 commit 6939851

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

linera-service/src/exporter/main.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,17 @@ impl Runnable for ExporterContext {
116116
);
117117

118118
let service = ExporterService::new(sender);
119-
service
120-
.run(shutdown_notifier, self.config.service_config.port)
121-
.await?;
122-
handle.join().unwrap()
119+
120+
let mut block_processor_task = tokio::task::spawn_blocking(move || handle.join().unwrap());
121+
tokio::select! {
122+
result = service.run(shutdown_notifier, self.config.service_config.port) => {
123+
result?;
124+
block_processor_task.await.expect("block processor task panicked")
125+
}
126+
result = &mut block_processor_task => {
127+
result.expect("block processor task panicked")
128+
}
129+
}
123130
}
124131
}
125132

0 commit comments

Comments
 (0)