abbccdda commented on a change in pull request #8702:
URL: https://github.com/apache/kafka/pull/8702#discussion_r428986739



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinator.java
##########
@@ -565,8 +566,8 @@ private void recordRebalanceFailure() {
 
         // Note that we override the request timeout using the rebalance 
timeout since that is the
         // maximum time that it may block on the coordinator. We add an extra 
5 seconds for small delays.
-
-        int joinGroupTimeoutMs = Math.max(rebalanceConfig.rebalanceTimeoutMs, 
rebalanceConfig.rebalanceTimeoutMs + 5000);
+        int joinGroupTimeoutMs = Math.max(client.defaultRequestTimeoutMs(),

Review comment:
       Could we log a debug info here for the timeout we used?

##########
File path: 
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AbstractCoordinatorTest.java
##########
@@ -312,8 +313,27 @@ public void testJoinGroupRequestTimeout() {
         mockTime.sleep(REQUEST_TIMEOUT_MS + 1);
         assertFalse(consumerClient.poll(future, mockTime.timer(0)));
 
-        mockTime.sleep(REBALANCE_TIMEOUT_MS - REQUEST_TIMEOUT_MS + 5000);
+        mockTime.sleep(REBALANCE_TIMEOUT_MS - REQUEST_TIMEOUT_MS + 
AbstractCoordinator.JOIN_GROUP_TIMEOUT_LAPSE);
         assertTrue(consumerClient.poll(future, mockTime.timer(0)));
+        assertTrue(future.exception() instanceof DisconnectException);
+    }
+
+    @Test
+    public void 
testJoinGroupRequestTimeoutLowerBoundedByDefaultRequestTimeout() {
+        int rebalanceTimeoutMs = REQUEST_TIMEOUT_MS - 10000;
+        setupCoordinator(RETRY_BACKOFF_MS, rebalanceTimeoutMs, 
Optional.empty());
+        mockClient.prepareResponse(groupCoordinatorResponse(node, 
Errors.NONE));
+        coordinator.ensureCoordinatorReady(mockTime.timer(0));
+
+        RequestFuture<ByteBuffer> future = coordinator.sendJoinGroupRequest();
+
+        long expectedRequestDeadline = mockTime.milliseconds() + 
REQUEST_TIMEOUT_MS;
+        mockTime.sleep(rebalanceTimeoutMs + 
AbstractCoordinator.JOIN_GROUP_TIMEOUT_LAPSE + 1);
+        assertFalse(consumerClient.poll(future, mockTime.timer(0)));
+
+        mockTime.sleep(expectedRequestDeadline - mockTime.milliseconds() + 1);

Review comment:
       We could just test `mockTime.sleep(REQUEST_TIMEOUT_MS + 1)` for this 
case and get rid of `expectedRequestDeadline`




----------------------------------------------------------------
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.

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


Reply via email to