mirror of
https://github.com/0glabs/0g-storage-node.git
synced 2025-04-04 15:35:18 +00:00
move backtrace
This commit is contained in:
parent
8c57422be1
commit
acd17bcfa7
@ -140,6 +140,9 @@ impl Store {
|
|||||||
{
|
{
|
||||||
let store = self.store.clone();
|
let store = self.store.clone();
|
||||||
let (tx, rx) = oneshot::channel();
|
let (tx, rx) = oneshot::channel();
|
||||||
|
let mut backtrace = Backtrace::new();
|
||||||
|
let frames = backtrace.frames().to_vec();
|
||||||
|
backtrace = frames.into();
|
||||||
|
|
||||||
self.executor.spawn_blocking(
|
self.executor.spawn_blocking(
|
||||||
move || {
|
move || {
|
||||||
@ -147,22 +150,15 @@ impl Store {
|
|||||||
let res = f(&*store);
|
let res = f(&*store);
|
||||||
|
|
||||||
if tx.send(res).is_err() {
|
if tx.send(res).is_err() {
|
||||||
|
warn!("Backtrace: {:?}", backtrace);
|
||||||
error!("Unable to complete async storage operation: the receiver dropped");
|
error!("Unable to complete async storage operation: the receiver dropped");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
WORKER_TASK_NAME,
|
WORKER_TASK_NAME,
|
||||||
);
|
);
|
||||||
|
|
||||||
rx.await.unwrap_or_else(|_| {
|
rx.await
|
||||||
let mut backtrace = Backtrace::new();
|
.unwrap_or_else(|_| bail!(error::Error::Custom("Receiver error".to_string())))
|
||||||
let mut frames = backtrace.frames().to_vec();
|
|
||||||
if frames.len() > 3 {
|
|
||||||
frames.drain(0..); //Remove the first 3 unnecessary frames to simplify// backtrace
|
|
||||||
backtrace = frames.into();
|
|
||||||
Some(format!("{:?}", backtrace));
|
|
||||||
}
|
|
||||||
bail!(error::Error::Custom("Receiver error".to_string()))
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME(zz): Refactor the lock and async call here.
|
// FIXME(zz): Refactor the lock and async call here.
|
||||||
|
Loading…
Reference in New Issue
Block a user