glommio icon indicating copy to clipboard operation
glommio copied to clipboard

force submission of important IO requests

Open HippoBaro opened this issue 3 years ago • 1 comments

So far, we have been pretty lax when submitting stuff in the rings. We push a request in there, flush, and if it fails, we keep going.

This works for user requests that can wait until the next visit to the reactor but can cause problems for those requests we depend on. One such request is the preemption timer.

This commit adds a force flush logic that only returns if it has successfully submitted a specific number of events to the kernel and will even block as a last resort if it has to.

This replaces the old cancellation flushing logic that would poll the kernel for one million times and panic afterward.

Additionally, this fixes a bug that would leave cancellations in the queue, unsubmitted, if the number of cancellations exceeds the SQE ring capacity (which is pretty small at ~128 typically).

HippoBaro avatar Jan 19 '22 18:01 HippoBaro

For reference, this PR is motivated by the fact that I have an app that consistently panics at the following assertion:

https://github.com/DataDog/glommio/blob/69fd84b347ef5965d7930352a540c875f6431a66/glommio/src/sys/uring.rs#L1719-L1722

HippoBaro avatar Jan 19 '22 18:01 HippoBaro