merlimat commented on a change in pull request #3240: timeout stuck 
producer/consumer operation request
URL: https://github.com/apache/pulsar/pull/3240#discussion_r243723360
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ClientCnx.java
 ##########
 @@ -668,6 +668,16 @@ SocketAddress serverAddrees() {
                 future.completeExceptionally(writeFuture.cause());
             }
         });
+        eventLoopGroup.schedule(() -> {
+            CompletableFuture<ProducerResponse> requestFuture = 
pendingRequests.remove(requestId);
+            if (requestFuture != null && !requestFuture.isDone()) {
+                log.warn("{} request {} timed out after {} ms", ctx.channel(), 
requestId, operationTimeoutMs);
+                future.completeExceptionally(
 
 Review comment:
   We should probably only print the warning if we timed it out. eg: 
   
   ```java
   if (requestFuture != null 
       && !requestFuture.isDone()
       && future.completeExceptionally(
                   new TimeoutException(requestId + 
                         " lookup request timedout after ms " + 
operationTimeoutMs)
      ) { 
      log.warn("....");
   }
   ```
   
   Also, shouldn't `requestFuture` be marked as failed too?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to