File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
pulsar-client/src/main/java/org/apache/pulsar/client/impl Expand file tree Collapse file tree 1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,7 @@ public OpSendMsg createOpSendMsg() throws IOException {
273273
274274 // handle mgs size check as non-batched in `ProducerImpl.isMessageSizeExceeded`
275275 if (op .getMessageHeaderAndPayloadSize () > getMaxMessageSize ()) {
276+ cmd .release ();
276277 producer .semaphoreRelease (1 );
277278 producer .client .getMemoryLimitController ().releaseMemory (
278279 messages .get (0 ).getUncompressedSize () + batchAllocatedSizeBytes );
@@ -286,6 +287,7 @@ public OpSendMsg createOpSendMsg() throws IOException {
286287 ByteBuf encryptedPayload = producer .encryptMessage (messageMetadata , getCompressedBatchMetadataAndPayload ());
287288 updateAndReserveBatchAllocatedSize (encryptedPayload .capacity ());
288289 if (encryptedPayload .readableBytes () > getMaxMessageSize ()) {
290+ encryptedPayload .release ();
289291 producer .semaphoreRelease (messages .size ());
290292 messages .forEach (msg -> producer .client .getMemoryLimitController ()
291293 .releaseMemory (msg .getUncompressedSize ()));
You can’t perform that action at this time.
0 commit comments