print query map for deadlock when using parallel front end
This commit is contained in:
parent
739d556826
commit
d5e4bd8922
@ -38,7 +38,7 @@ pub struct QueryInfo {
|
|||||||
pub type QueryMap = FxHashMap<QueryJobId, QueryJobInfo>;
|
pub type QueryMap = FxHashMap<QueryJobId, QueryJobInfo>;
|
||||||
|
|
||||||
/// A value uniquely identifying an active query job.
|
/// A value uniquely identifying an active query job.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Hash)]
|
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
|
||||||
pub struct QueryJobId(pub NonZeroU64);
|
pub struct QueryJobId(pub NonZeroU64);
|
||||||
|
|
||||||
impl QueryJobId {
|
impl QueryJobId {
|
||||||
@ -62,14 +62,14 @@ fn latch(self, map: &QueryMap) -> Option<&QueryLatch> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct QueryJobInfo {
|
pub struct QueryJobInfo {
|
||||||
pub query: QueryStackFrame,
|
pub query: QueryStackFrame,
|
||||||
pub job: QueryJob,
|
pub job: QueryJob,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents an active query job.
|
/// Represents an active query job.
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct QueryJob {
|
pub struct QueryJob {
|
||||||
pub id: QueryJobId,
|
pub id: QueryJobId,
|
||||||
|
|
||||||
@ -182,6 +182,7 @@ pub fn try_find_layout_root(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(parallel_compiler)]
|
#[cfg(parallel_compiler)]
|
||||||
|
#[derive(Debug)]
|
||||||
struct QueryWaiter {
|
struct QueryWaiter {
|
||||||
query: Option<QueryJobId>,
|
query: Option<QueryJobId>,
|
||||||
condvar: Condvar,
|
condvar: Condvar,
|
||||||
@ -198,13 +199,14 @@ fn notify(&self, registry: &rayon_core::Registry) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(parallel_compiler)]
|
#[cfg(parallel_compiler)]
|
||||||
|
#[derive(Debug)]
|
||||||
struct QueryLatchInfo {
|
struct QueryLatchInfo {
|
||||||
complete: bool,
|
complete: bool,
|
||||||
waiters: Vec<Arc<QueryWaiter>>,
|
waiters: Vec<Arc<QueryWaiter>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(parallel_compiler)]
|
#[cfg(parallel_compiler)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub(super) struct QueryLatch {
|
pub(super) struct QueryLatch {
|
||||||
info: Arc<Mutex<QueryLatchInfo>>,
|
info: Arc<Mutex<QueryLatchInfo>>,
|
||||||
}
|
}
|
||||||
@ -540,7 +542,11 @@ pub fn deadlock(query_map: QueryMap, registry: &rayon_core::Registry) {
|
|||||||
// X to Y due to Rayon waiting and a true dependency from Y to X. The algorithm here
|
// X to Y due to Rayon waiting and a true dependency from Y to X. The algorithm here
|
||||||
// only considers the true dependency and won't detect a cycle.
|
// only considers the true dependency and won't detect a cycle.
|
||||||
if !found_cycle {
|
if !found_cycle {
|
||||||
panic!("deadlock detected");
|
if query_map.len() == 0 {
|
||||||
|
panic!("deadlock detected without any query!")
|
||||||
|
} else {
|
||||||
|
panic!("deadlock detected! current query map:\n{:?}", query_map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: Ensure this won't cause a deadlock before we return
|
// FIXME: Ensure this won't cause a deadlock before we return
|
||||||
|
@ -203,7 +203,7 @@ fn drop(&mut self) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) struct CycleError {
|
pub(crate) struct CycleError {
|
||||||
/// The query and related span that uses the cycle.
|
/// The query and related span that uses the cycle.
|
||||||
pub usage: Option<(Span, QueryStackFrame)>,
|
pub usage: Option<(Span, QueryStackFrame)>,
|
||||||
|
Loading…
Reference in New Issue
Block a user