From 5ee1f2c7ec4e43b2273cab7d7a94e9b2f4c2e52d Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 9 Sep 2020 10:05:14 +0200 Subject: [PATCH] Handle when io_uring_enter(...) fails with EINTR (#10540) Motivation: It is possible that io_uring_enter(...) fails with EINTR. In this case we should just retry the operation Modifications: Retry when EINTR was detected Result: More correct use of io_uring_enter(...) --- .../src/main/c/netty_io_uring_native.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/transport-native-io_uring/src/main/c/netty_io_uring_native.c b/transport-native-io_uring/src/main/c/netty_io_uring_native.c index a008fff00f..c1992af0ce 100644 --- a/transport-native-io_uring/src/main/c/netty_io_uring_native.c +++ b/transport-native-io_uring/src/main/c/netty_io_uring_native.c @@ -167,7 +167,15 @@ void setup_io_uring(int ring_fd, struct io_uring *io_uring_ring, static jint netty_io_uring_enter(JNIEnv *env, jclass class1, jint ring_fd, jint to_submit, jint min_complete, jint flags) { - return sys_io_uring_enter(ring_fd, to_submit, min_complete, flags, NULL); + int result; + int err; + do { + result = sys_io_uring_enter(ring_fd, to_submit, min_complete, flags, NULL); + if (result >= 0) { + return result; + } + } while((err = errno) == EINTR); + return -err; } static jint netty_epoll_native_eventFd(JNIEnv* env, jclass clazz) {