You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that if respectMaybeMoreData = false and maxMessagesPerRead > 1, then channelReadComplete is not called
EchoIOUringClient
public class EchoIOUringClient {
public static void main(String... args) {
IOUringEventLoopGroup group = new IOUringEventLoopGroup(1);
try {
FixedRecvByteBufAllocator allocator = new FixedRecvByteBufAllocator(2000);
allocator.respectMaybeMoreData(false);
allocator.maxMessagesPerRead(2);
Bootstrap b = new Bootstrap();
b.group(group)
.channel(IOUringSocketChannel.class)
// TODO channelReadComplete not calling
.option(ChannelOption.RCVBUF_ALLOCATOR, allocator)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) {
ChannelPipeline p = ch.pipeline();
p.addLast(new HttpClientCodec());
p.addLast(new LoggingHandler(LogLevel.INFO));
}
});
String host = "google.com";
int port = 80;
DefaultHttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "http://" + host + "/");
request.headers().set(HttpHeaderNames.HOST, host);
// Start the client.
ChannelFuture f = b.connect(host, port).sync();
f.addListener((GenericFutureListener<ChannelFuture>) channelFuture -> {
if (channelFuture.isSuccess()) {
Channel channel = channelFuture.channel();
channel.writeAndFlush(request);
} else {
channelFuture.cause().printStackTrace();
}
});
// Wait until the connection is closed.
f.channel().closeFuture().sync();
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
// Shut down the event loop to terminate all threads.
group.shutdownGracefully();
}
}
}
log
Feb 10, 2023 8:42:46 PM io.netty.handler.logging.LoggingHandler channelRegistered
INFO: [id: 0xe58606fe] REGISTERED
Feb 10, 2023 8:42:46 PM io.netty.handler.logging.LoggingHandler connect
INFO: [id: 0xe58606fe] CONNECT: google.com/216.58.208.110:80
Feb 10, 2023 8:42:46 PM io.netty.handler.logging.LoggingHandler channelActive
INFO: [id: 0xe58606fe, L:/45.63.40.90:32004 - R:google.com/216.58.208.110:80] ACTIVE
Feb 10, 2023 8:42:46 PM io.netty.handler.logging.LoggingHandler write
INFO: [id: 0xe58606fe, L:/45.63.40.90:32004 - R:google.com/216.58.208.110:80] WRITE: DefaultHttpRequest(decodeResult: success, version: HTTP/1.1)
GET http://google.com/ HTTP/1.1
host: google.com
Feb 10, 2023 8:42:46 PM io.netty.handler.logging.LoggingHandler flush
INFO: [id: 0xe58606fe, L:/45.63.40.90:32004 - R:google.com/216.58.208.110:80] FLUSH
Feb 10, 2023 8:42:46 PM io.netty.handler.logging.LoggingHandler channelRead
INFO: [id: 0xe58606fe, L:/45.63.40.90:32004 - R:google.com/216.58.208.110:80] READ: DefaultHttpResponse(decodeResult: success, version: HTTP/1.1)
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Fri, 10 Feb 2023 17:42:46 GMT
Expires: Sun, 12 Mar 2023 17:42:46 GMT
Cache-Control: public, max-age=2592000
Server: gws
Content-Length: 219
X-XSS-Protection: 0
X-Frame-Options: SAMEORIGIN
Feb 10, 2023 8:42:46 PM io.netty.handler.logging.LoggingHandler channelRead
INFO: [id: 0xe58606fe, L:/45.63.40.90:32004 - R:google.com/216.58.208.110:80] READ: DefaultLastHttpContent(data: PooledSlicedByteBuf(ridx: 0, widx: 219, cap: 219/219, unwrapped: PooledUnsafeDirectByteBuf(ridx: 528, widx: 528, cap: 2000)), decoderResult: success), 219B
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 3c 48 54 4d 4c 3e 3c 48 45 41 44 3e 3c 6d 65 74 |<HTML><HEAD><met|
|00000010| 61 20 68 74 74 70 2d 65 71 75 69 76 3d 22 63 6f |a http-equiv="co|
|00000020| 6e 74 65 6e 74 2d 74 79 70 65 22 20 63 6f 6e 74 |ntent-type" cont|
|00000030| 65 6e 74 3d 22 74 65 78 74 2f 68 74 6d 6c 3b 63 |ent="text/html;c|
|00000040| 68 61 72 73 65 74 3d 75 74 66 2d 38 22 3e 0a 3c |harset=utf-8">.<|
|00000050| 54 49 54 4c 45 3e 33 30 31 20 4d 6f 76 65 64 3c |TITLE>301 Moved<|
|00000060| 2f 54 49 54 4c 45 3e 3c 2f 48 45 41 44 3e 3c 42 |/TITLE></HEAD><B|
|00000070| 4f 44 59 3e 0a 3c 48 31 3e 33 30 31 20 4d 6f 76 |ODY>.<H1>301 Mov|
|00000080| 65 64 3c 2f 48 31 3e 0a 54 68 65 20 64 6f 63 75 |ed</H1>.The docu|
|00000090| 6d 65 6e 74 20 68 61 73 20 6d 6f 76 65 64 0a 3c |ment has moved.<|
|000000a0| 41 20 48 52 45 46 3d 22 68 74 74 70 3a 2f 2f 77 |A HREF="http://w|
|000000b0| 77 77 2e 67 6f 6f 67 6c 65 2e 63 6f 6d 2f 22 3e |ww.google.com/">|
|000000c0| 68 65 72 65 3c 2f 41 3e 2e 0d 0a 3c 2f 42 4f 44 |here</A>...</BOD|
|000000d0| 59 3e 3c 2f 48 54 4d 4c 3e 0d 0a |Y></HTML>.. |
+--------+-------------------------------------------------+----------------+
The text was updated successfully, but these errors were encountered:
abezhovets
changed the title
Use io_uring with respectMaybeMoreData flag for RecvByteBufAllocator
Use io_uring with respectMaybeMoreData flag for RecvByteBufAllocatorFeb 10, 2023
I found that if
respectMaybeMoreData
= false andmaxMessagesPerRead
> 1, thenchannelReadComplete
is not calledEchoIOUringClient
log
The text was updated successfully, but these errors were encountered: