axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.77k stars 398 forks source link

When using epoll to listen on multiple uring_fds, occasionally, when an event occurs on a uring_fd, it may not wake up the epoll. #1029

Closed sxstd001 closed 5 months ago

sxstd001 commented 8 months ago

When using epoll to listen on multiple uring_fds, occasionally, when an event occurs on a uring_fd, it may not wake up the epoll.

Scenario: Using epoll_wait to monitor multiple uring_fds. When submitting io_uring_prep_nop to one of the uring_fds, sometimes epoll is not awakened. a very mysterious bug. By proactively peek the uring, can peek at the nop_sqe that was submitted earlier.

axboe commented 8 months ago

Do you have a reproducer for this? I can certainly take a look, but would save me a lot of time if I didn't have to write a reproducer first.

axboe commented 8 months ago

Please include a comment when you close an issue. Was it a problem in your application?

sxstd001 commented 5 months ago

if use params.flags |= IORING_SETUP_SINGLE_ISSUER; Instantiate IO_URING must in it's owner thread.

isilence commented 5 months ago

or you can create it with IORING_SETUP_R_DISABLED, pass the ring to your final task/process and enable it there using IORING_REGISTER_ENABLE_RINGS.