openraft icon indicating copy to clipboard operation
openraft copied to clipboard

Feature: Monoio Runtime

Open Miaxos opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

I want to use openraft with monoio.

Describe the solution you'd like

A feature flag with a MonoioAsyncRuntime available.

Additional context

I started a draft over this on https://github.com/datafuselabs/openraft/pull/1010 but there are some issues:

  • is_panic & abort can be a little more complex to implement as in monoio and when you use io-uring you register to the kernel when you start reading/writing with fd. For monoio, you have to pass a Canceller. to be mapped on the operation you do on those IO to be able to have a proper cancellation.

Miaxos avatar Feb 16 '24 15:02 Miaxos

👋 Thanks for opening this issue!

Get help or engage by:

  • /help : to print help messages.
  • /assignme : to assign this issue to you.

github-actions[bot] avatar Feb 16 '24 15:02 github-actions[bot]

AsyncRuntime::abort() is not mandatory and can be removed:

  • #1012

drmingdrmer avatar Feb 17 '24 06:02 drmingdrmer

monoio is a little bit different about is_panic: AFAIK it's a single-threaded runtime(the future to run need no Send):

If it panics, the runtime just destroyed. There won't be any other task to examine the JoinHandle of the task in the destroyed runtime. And if send the JoinHandle to another thread(also another monoio runtime) to poll it with JoinHandle.await, there looks like to be some bug: it has chance to block forever:

  • https://github.com/bytedance/monoio/issues/241

Because of this issue, I can not tell what JoinHandle.await gets when the corresponding task panics.

Meanwhile, according to the API doc, monoio JoinHandle.await does not return a Result, MonoioRuntime::is_panic() could just return false.

drmingdrmer avatar Feb 17 '24 12:02 drmingdrmer