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/11/07 15:09:57 UTC

[GitHub] [pulsar] codelipenghui commented on a change in pull request #5587: [Issue 5585][pulsar-client] Fix producer Semaphore release error

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

 ##########
 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:
   Do you want to ‘clear’ or ‘reset’ the semaphore here? I think we can't ‘clear’ the semaphore here, because acquire semaphore don't get the producer instance lock,  if others is already acquired, here will ‘release’ it and it also might lead the dead lock right?

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