Skip to content

Commit eb5776e

Browse files
kixelatedcodex
andauthored
fix(native): remove deadlock detection (#3166)
Co-authored-by: Codex <codex@openai.com>
1 parent 85c9f48 commit eb5776e

4 files changed

Lines changed: 6 additions & 54 deletions

File tree

Cargo.lock

Lines changed: 0 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rs/moq-native/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ moq-net = { workspace = true }
5454
# congestion configs. Version matched to the copy iroh pulls in.
5555
noq-proto = { version = "1", default-features = false, optional = true }
5656
notify = { version = "8", optional = true }
57-
parking_lot = { version = "0.12", features = ["deadlock_detection"] }
5857
qmux = { workspace = true, features = ["wss", "tls", "tcp"], optional = true }
5958
quinn = { version = "0.11", default-features = false, features = ["platform-verifier", "runtime-tokio", "bloom"], optional = true }
6059
rand = { workspace = true }

rs/moq-native/src/accept.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
use std::{
2727
io,
2828
sync::{
29-
Arc,
29+
Arc, Mutex,
3030
atomic::{AtomicU64, Ordering},
3131
},
3232
time::{Duration, Instant},
@@ -214,7 +214,7 @@ struct Inner {
214214
connection: AtomicU64,
215215
exhausted: AtomicU64,
216216
unknown: AtomicU64,
217-
state: parking_lot::Mutex<State>,
217+
state: Mutex<State>,
218218
}
219219

220220
struct State {
@@ -235,7 +235,7 @@ impl Health {
235235
connection: AtomicU64::new(0),
236236
exhausted: AtomicU64::new(0),
237237
unknown: AtomicU64::new(0),
238-
state: parking_lot::Mutex::new(State {
238+
state: Mutex::new(State {
239239
stall: None,
240240
consecutive: 0,
241241
delay: RETRY_MIN,
@@ -251,7 +251,7 @@ impl Health {
251251
/// An accept succeeded: the listener is serving, so any stall is over and the
252252
/// next failure starts from the shortest delay again.
253253
pub fn accepted(&self) {
254-
let mut state = self.0.state.lock();
254+
let mut state = self.0.state.lock().unwrap();
255255
if state.stall.take().is_some() {
256256
tracing::info!(listener = self.0.listener, "listener is accepting again");
257257
}
@@ -276,7 +276,7 @@ impl Health {
276276
return None;
277277
}
278278

279-
let mut state = self.0.state.lock();
279+
let mut state = self.0.state.lock().unwrap();
280280
state.consecutive += 1;
281281
let delay = jitter(state.delay);
282282
state.delay = (state.delay * 2).min(RETRY_MAX);
@@ -316,7 +316,7 @@ impl Health {
316316
/// Only a successful accept clears it, so a listener with no traffic holds its
317317
/// last value rather than claiming a recovery it has no evidence for.
318318
pub fn stalled(&self) -> Option<Duration> {
319-
self.0.state.lock().stall.map(|since| since.elapsed())
319+
self.0.state.lock().unwrap().stall.map(|since| since.elapsed())
320320
}
321321

322322
fn counter(&self, failure: Failure) -> &AtomicU64 {

rs/moq-native/src/log.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -79,34 +79,6 @@ impl Log {
7979
.try_init()
8080
.map_err(|e| crate::Error::SetSubscriber(std::sync::Arc::new(e)))?;
8181

82-
// Start deadlock detection thread (only in debug builds)
83-
#[cfg(debug_assertions)]
84-
std::thread::spawn(Self::deadlock_detector);
85-
8682
Ok(())
8783
}
88-
89-
#[cfg(debug_assertions)]
90-
fn deadlock_detector() {
91-
loop {
92-
std::thread::sleep(std::time::Duration::from_secs(1));
93-
94-
let deadlocks = parking_lot::deadlock::check_deadlock();
95-
if deadlocks.is_empty() {
96-
continue;
97-
}
98-
99-
tracing::error!("DEADLOCK DETECTED");
100-
101-
for (i, threads) in deadlocks.iter().enumerate() {
102-
tracing::error!("Deadlock #{}", i);
103-
for t in threads {
104-
tracing::error!("Thread Id {:#?}", t.thread_id());
105-
tracing::error!("{:#?}", t.backtrace());
106-
}
107-
}
108-
109-
// Optionally: std::process::abort() to get a core dump
110-
}
111-
}
11284
}

0 commit comments

Comments
 (0)