Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawn log ingester thread in a tokio runtime to fix jobsrv panic #1685

Merged
merged 1 commit into from
Dec 22, 2021
Merged
Changes from all 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
15 changes: 9 additions & 6 deletions components/builder-jobsrv/src/server/log_ingester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use crate::{bldr_core::socket::DEFAULT_CONTEXT,
server::{log_archiver::{self,
LogArchiver},
log_directory::LogDirectory}};
use futures::executor::block_on;
use std::{fs::{self,
OpenOptions},
io::Write,
Expand Down Expand Up @@ -64,11 +63,15 @@ impl LogIngester {
-> Result<JoinHandle<()>> {
let mut ingester = Self::new(cfg, log_dir, data_store);
let (tx, rx) = mpsc::sync_channel(1);
let handle = thread::Builder::new().name("log-ingester".to_string())
.spawn(move || {
block_on(ingester.run(&tx)).unwrap();
})
.unwrap();
let handle =
thread::Builder::new().name("log-ingester".to_string())
.spawn(move || {
tokio::runtime::Runtime::new().expect("Unable to create \
tokio runtime")
.block_on(ingester.run(&tx))
.unwrap()
})
.unwrap();
match rx.recv() {
Ok(()) => Ok(handle),
Err(e) => panic!("log-ingester thread startup error, err={}", e),
Expand Down