Tommy Becker created KAFKA-5044:
-----------------------------------

             Summary: max.in.flight.requests.per.connection > 1 is ineffective
                 Key: KAFKA-5044
                 URL: https://issues.apache.org/jira/browse/KAFKA-5044
             Project: Kafka
          Issue Type: Bug
          Components: clients
            Reporter: Tommy Becker


While looking at the NetworkClient code, I became suspicious about the 
implementation of org.apache.kafka.clients.InFlightRequests#canSendMore, which 
seems responsible for enforcing max.in.flight.requests.per.connection

{code}
public boolean canSendMore(String node) {
        Deque<NetworkClient.InFlightRequest> queue = requests.get(node);
        return queue == null || queue.isEmpty() ||
               (queue.peekFirst().send.completed() && queue.size() < 
this.maxInFlightRequestsPerConnection);
    }
{code}

If the most recent request has not been completed, then this returns false even 
if we are under the maxInFlightRequestsPerConnection limit. I wonder if I am 
misunderstanding how this parameter is supposed to work, as this code has been 
there quite some time. But I wrote a unit test that tries to send a second 
request with one outstanding and it does indeed fail, despite 
maxInFlightRequestsPerConnection being set to Integer.MAX_VALUE. I'll create a 
PR with my test and possible fix.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to