FrankChen021 commented on code in PR #19567:
URL: https://github.com/apache/druid/pull/19567#discussion_r3380362866


##########
processing/src/main/java/org/apache/druid/java/util/http/client/NettyHttpClient.java:
##########
@@ -131,29 +123,30 @@ public <Intermediate, Final> ListenableFuture<Final> go(
       return Futures.immediateFailedFuture(
           new ChannelException(
               "Faulty channel in resource pool",
-              channelFuture.getCause()
+              channelFuture.cause()
           )
       );
     } else {
-      channel = channelFuture.getChannel();
+      channel = channelFuture.channel();
 
-      // In case we get a channel that never had its readability turned back 
on.
-      channel.setReadable(true);
+      // In case we get a channel that never had its reads turned back on.
+      channel.config().setAutoRead(true);
     }
     final String urlFile = 
StringUtils.nullToEmptyNonDruidDataString(url.getFile());
-    final HttpRequest httpRequest = new DefaultHttpRequest(
+    final FullHttpRequest httpRequest = new DefaultFullHttpRequest(
         HttpVersion.HTTP_1_1,
         method,
-        urlFile.isEmpty() ? "/" : urlFile
+        urlFile.isEmpty() ? "/" : urlFile,
+        request.hasContent() ? request.getContent() : Unpooled.EMPTY_BUFFER

Review Comment:
   [P1] Do not hand the request-owned ByteBuf to Netty
   
   This passes the Request's stored ByteBuf directly into a Netty 4 
FullHttpRequest. Netty's HTTP encoder releases FullHttpMessages after encoding, 
and may also advance the content reader index, so after the first send 
request.getContent() can be released or consumed. Kerberos' 401 retry path 
calls request.copy() after the first response, which can then fail or resend an 
empty body for authenticated POSTs. Please build the outbound request from a 
retained duplicate/copy, or make Request store bytes and create a fresh ByteBuf 
per send.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to