You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/10/22 21:54:03 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #5442: [pulsar-client] Avoid leak on publish failure on batch message

merlimat commented on a change in pull request #5442: [pulsar-client] Avoid leak on publish failure on batch message
URL: https://github.com/apache/pulsar/pull/5442#discussion_r337768299
 
 

 ##########
 File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
 ##########
 @@ -468,10 +468,13 @@ private void doBatchSendAndAdd(MessageImpl<T> msg, SendCallback callback, ByteBu
             log.debug("[{}] [{}] Closing out batch to accommodate large message with size {}", topic, producerName,
                     msg.getDataBuffer().readableBytes());
         }
-        batchMessageAndSend();
-        batchMessageContainer.add(msg, callback);
-        lastSendFuture = callback.getFuture();
-        payload.release();
+        try {
+            batchMessageAndSend();
+            batchMessageContainer.add(msg, callback);
+            lastSendFuture = callback.getFuture();
+        } finally {
 
 Review comment:
   If we do get exception here, shouldn't we also trigger the send callback?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services