Comments (12)
I'll get a fix up in a bit.
from tokio-uring.
@FrankReh could you review the RT changes?
from tokio-uring.
You've hit an issue I found while fixing something else months ago, decided I would fix the next day, and then promptly forgot about until now lmao.
io_uring
has an unfortunate footgun where you can put more events in-flight than the completion queue can hold, thus allowing you to overflow the queue. If the queue overflows, the extra completions are yeeted into the void, never to be received.
The solution here is to add a semaphore to make sure we can't put more events in-flight than the cqueue can hold.
from tokio-uring.
Huh? My understanding is that this was true in the first versions of the driver, but hasn't this been fixed? As far as I know, the driver should hold on to completions that don't fit until you empty the completion queue.
from tokio-uring.
@Darksonn no, still an issue, its a weird edge in the kernel APIs. The kernel drops completions in the event of an overflow. A semaphore is currently the workaround.
from tokio-uring.
@Noah-Kennedy There is a CQ_OVERFLOW bit in the submission queue now and the rust io-uring bindings exposes it with the method cq_overflow on the ring's squeue. I believe the intent for this bit is to let the user space know when the kernel couldn't add to the cq so after the user space has drained some or all of the cq ring, it is up to the user space to kick the kernel again so the kernel will again fill the cq. I don't think the kernel is actually dropping information, it is probably just being queued up by an internal mechanism.
Getting tokio-uring to use this mechanism seems safer than trying to add a semaphore because there will be other reasons for the cq filling up too, the multi-shot operations come to mind.
from tokio-uring.
@FrankReh I will need to look at this, but I agree that this sounds like a much better option!
from tokio-uring.
@FrankReh I think i've hit this too - I will also take a look
from tokio-uring.
I think I saw the problem fixed locally by using the CQ_OVERFLOW bit to say when tick should be run again. But I was waiting for the Rc/RefCell driver rework. My solution had tick to using a loop and checking the squeue bit itself for deciding when to run again. I wasn't thrilled with the memory sync options that were available and saw a recent PR for io-uring that would have separated read and write fences but it wasn't accepted yet.
The Rc removal hasn't been committed yet. And I wanted to see if the RefCell couldn't be pushed further down so tick didn't need to be given a mutable driver either.
Not to say you shouldn't look at the problem. Maybe you'll find a better way.
from tokio-uring.
Let's go with your approach once the rt changes get committed.
from tokio-uring.
If the rt changes don't go today or tomorrow, I may send a PR that shows what I had done so far anyway. Could help since a few people have run into cases where the CQ_OVERFLOW mechanism would have helped.
from tokio-uring.
This has been solved. Waiting for tokio-rs/io-uring#152 or its equivalent to be merged and then this crate's version for io-uring to be bumped appropriately.
from tokio-uring.
Related Issues (20)
- Proposal for overhaul of buffer representation HOT 11
- multi_thread support HOT 5
- Direct IO HOT 2
- Support _msg syscalls HOT 4
- impl Clone for stream types?
- Add chunks() for BoundedBuf
- Not in a runtime context is not always true HOT 5
- Return msghdr from `recvmsg`
- DPDK support? HOT 5
- Dead or dying? HOT 9
- Support for windows IOCP (input/output completion ports) another completion-based async API HOT 1
- Is it support `splice` operation now?
- New Release? HOT 3
- tokio-uring missing similar tokio runtime builder options
- io_uring command support? HOT 3
- Support for IO_LINK feature
- Restructuring HOT 2
- __io_uring_buf_ring_cq_advance broken? HOT 1
- [BUG] Hangs when using iopoll without sqpoll HOT 2
- Expose access to io_uring in the form of submission and completion queues HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tokio-uring.