Skip to content

Commit 3c40c1a

Browse files
authored
chore epend on io-uring version ^0.5.8 (tokio-rs#153)
io-uring v0.5.8 handles the overflow of the cqueue so this bump on the dependancy fixes hangs caused when high frequency submissions fill the cqueue. While we're at it, adds a unit test for such a hanging cqueue.
1 parent 4a10a9c commit 3c40c1a

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ tokio = { version = "1.2", features = ["net", "rt"] }
2121
scoped-tls = "1.0.0"
2222
slab = "0.4.2"
2323
libc = "0.2.80"
24-
io-uring = { version = "0.5.0", features = [ "unstable" ] }
25-
socket2 = { version = "0.4.4", features = [ "all"] }
24+
io-uring = { version = "0.5.8", features = ["unstable"] }
25+
socket2 = { version = "0.4.4", features = ["all"] }
2626
bytes = { version = "1.0", optional = true }
2727

2828
[dev-dependencies]

tests/driver.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,38 @@ fn too_many_submissions() {
9090
});
9191
}
9292

93+
#[test]
94+
fn completion_overflow() {
95+
use std::process;
96+
use std::{thread, time};
97+
use tokio::task::JoinSet;
98+
99+
let spawn_cnt = 50;
100+
let squeue_entries = 2;
101+
let cqueue_entries = 2 * squeue_entries;
102+
103+
std::thread::spawn(|| {
104+
thread::sleep(time::Duration::from_secs(8)); // 1000 times longer than it takes on a slow machine
105+
eprintln!("Timeout reached. The uring completions are hung.");
106+
process::exit(1);
107+
});
108+
109+
tokio_uring::builder()
110+
.entries(squeue_entries)
111+
.uring_builder(tokio_uring::uring_builder().setup_cqsize(cqueue_entries))
112+
.start(async move {
113+
let mut js = JoinSet::new();
114+
115+
for _ in 0..spawn_cnt {
116+
js.spawn_local(tokio_uring::no_op());
117+
}
118+
119+
while let Some(res) = js.join_next().await {
120+
res.unwrap().unwrap();
121+
}
122+
});
123+
}
124+
93125
fn tempfile() -> NamedTempFile {
94126
NamedTempFile::new().unwrap()
95127
}

0 commit comments

Comments
 (0)