Skip to content

Commit a9234c3

Browse files
authored
IoUring: Correctly refetch completions that were produced because of … (#15480)
…inline submissions Motivation: We should ensure we refetch the tail of the completion queue and compare it to the current head before stop processing because a completion might trigger a submission and so produce more completions. Modifications: Refetch tail one more time before exit while loop Result: Process completions that were caused by an inline submission without delay
1 parent f8beddd commit a9234c3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

transport-classes-io_uring/src/main/java/io/netty/channel/uring/CompletionQueue.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ int process(CompletionCallback callback) {
112112
// Stop processing. as the callback can not handle any more completions for now,
113113
break;
114114
}
115+
if (ringHead == tail) {
116+
// Let's fetch the tail one more time as it might have changed because a completion might have
117+
// triggered a submission (io_uring_enter). This can happen as we automatically submit once we
118+
// run out of space in the submission queue.
119+
tail = (int) INT_HANDLE.getVolatile(ktail, 0);
120+
}
115121
}
116122
return i;
117123
} finally {

0 commit comments

Comments
 (0)