Skip to content

Commit 8603953

Browse files
committed
fix the recursive read deadlock
1 parent 5267e8e commit 8603953

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

raphtory-core/src/storage/raw_edges.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ impl EdgesStorage {
187187
pub fn get_edge(&self, eid: EID) -> EdgeRGuard {
188188
let (bucket, offset) = self.resolve(eid.into());
189189
EdgeRGuard {
190-
guard: self.shards[bucket].read(),
190+
guard: self.shards[bucket].read_recursive(),
191191
offset,
192192
}
193193
}

raphtory-graphql/src/rayon.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@ use rayon::{ThreadPool, ThreadPoolBuilder};
22
use std::sync::LazyLock;
33
use tokio::sync::oneshot;
44

5-
static WRITE_POOL: LazyLock<ThreadPool> = LazyLock::new(|| {
6-
ThreadPoolBuilder::new()
7-
.build()
8-
.expect("failed to build threadpool")
9-
});
10-
115
/// Use the rayon threadpool to execute a task
126
///
137
/// Use this for long-running, compute-heavy work
@@ -25,7 +19,7 @@ pub async fn blocking_compute<R: Send + 'static, F: FnOnce() -> R + Send + 'stat
2519
/// Use a separate rayon threadpool to execute write tasks to avoid potential deadlocks
2620
pub async fn blocking_write<R: Send + 'static, F: FnOnce() -> R + Send + 'static>(closure: F) -> R {
2721
let (send, recv) = oneshot::channel();
28-
WRITE_POOL.spawn(move || {
22+
rayon::spawn(move || {
2923
let _ = send.send(closure()); // this only errors if no-one is listening anymore
3024
});
3125
recv.await.expect("Function panicked in rayon::spawn")

0 commit comments

Comments
 (0)