badaiaqrandista commented on code in PR #12416:
URL: https://github.com/apache/kafka/pull/12416#discussion_r927095680


##########
clients/src/main/java/org/apache/kafka/common/network/Selector.java:
##########
@@ -591,6 +591,11 @@ void pollSelectionKeys(Set<SelectionKey> selectionKeys,
                 long nowNanos = channelStartTimeNanos != 0 ? 
channelStartTimeNanos : currentTimeNanos;
                 try {
                     attemptWrite(key, channel, nowNanos);
+
+                    // Following is to fix KAFKA-13559. This will prevent 
poll() from blocking for 300 ms when the
+                    // socket has no data but the buffer has data. Only 
happens when using SSL.
+                    if (channel.hasBytesBuffered())
+                        madeReadProgressLastPoll = true;

Review Comment:
   @splett2 
   
   How about saying this in the comment:
   
   
   > After reading from the channel, "madeReadProgressLastPoll" was set to 
"true". However, because channel is muted while processing the previous 
request, "madeReadProgressLastPoll" was set to "false" by "clear()". Now that a 
response has been sent and channel is unmuted, we need to set 
"madeReadProgressLastPoll" back to "true" if there is additional data in the 
buffer, to ensure we process it immediately.
   
   



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to