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 2022/12/19 22:18:57 UTC

[GitHub] [pulsar] eolivelli commented on a diff in pull request #18989: [fix][broker] Fix deadlock in PendingAckHandleImpl

eolivelli commented on code in PR #18989:
URL: https://github.com/apache/pulsar/pull/18989#discussion_r1052685049


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/pendingack/impl/PendingAckHandleImpl.java:
##########
@@ -937,19 +937,24 @@ public TransactionPendingAckStats getStats(boolean lowWaterMarks) {
         return transactionPendingAckStats;
     }
 
-    public synchronized void completeHandleFuture() {
-        if (!this.pendingAckHandleCompletableFuture.isDone()) {
-            this.pendingAckHandleCompletableFuture.complete(PendingAckHandleImpl.this);
-        }
-        if (recoverTime.getRecoverStartTime() != 0L) {
-            recoverTime.setRecoverEndTime(System.currentTimeMillis());
+    public void completeHandleFuture() {
+        synchronized (this.pendingAckHandleCompletableFuture) {

Review Comment:
   Why are you using synchronized on this variable ?
   This smells a little bit (synchronize over a CompletableFuture)
   And also that reference escapes this object because there is a getter, so I don't think we are going to properly deal with concurrency here



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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org