weishuisheng commented on a change in pull request #5587: [Issue 
5585][pulsar-client] Fix producer Semaphore release error 
URL: https://github.com/apache/pulsar/pull/5587#discussion_r343961280
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java
 ##########
 @@ -1280,12 +1279,15 @@ private void failPendingMessages(ClientCnx cnx, 
PulsarClientException ex) {
                 ReferenceCountUtil.safeRelease(op.cmd);
                 op.recycle();
             });
-            semaphore.release(releaseCount.get());
+
             pendingMessages.clear();
             pendingCallbacks.clear();
             if (isBatchMessagingEnabled()) {
                 failPendingBatchMessages(ex);
             }
+
+            semaphore.drainPermits();
+            semaphore.release(conf.getMaxPendingMessages());
 
 Review comment:
   OK,I will fix it

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


With regards,
Apache Git Services

Reply via email to