tokio-rs / io-uring

The `io_uring` library for Rust
Apache License 2.0
1.19k stars 131 forks source link

Ring loosing entries? #114

Open tinywombat765 opened 3 years ago

tinywombat765 commented 3 years ago

I'm building a high level abstraction around io_uring. I've been testing it and when I submit entries from multiple threads it seems to occasionally loose entries. From inspecting the SQ they seem to be taken by the kernel with no issue. I'm not overflowing the SQ or CQ. The entry just never shows up in the CQ. I have the SQ in a mutex so multiple threads overwriting the entries. The entries lost are always write, idk if that's significant.

Here's the test I'm running that triggers the issue: https://git.sr.ht/~zethra/smol-uring/tree/uring-refactor/item/src/lib.rs#L89

And here's my code that actually does the submission: https://git.sr.ht/~zethra/smol-uring/tree/uring-refactor/item/src/lib.rs#L89

If you have any idea why this is happening, I'd appreciate input.

tinywombat765 commented 3 years ago

Well as it goes, 2 seconds after I post this issue I see the obvious thing I'm doing wrong. All of threads were opening an writing to the same file. Now it is weird that when they are all trying to write to the same file entries seem to get lost.