Jackie-Jiang commented on code in PR #16903:
URL: https://github.com/apache/pinot/pull/16903#discussion_r2414725991


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/mailbox/MailboxService.java:
##########
@@ -55,11 +55,14 @@ public class MailboxService {
       
CacheBuilder.newBuilder().expireAfterAccess(DANGLING_RECEIVING_MAILBOX_EXPIRY_SECONDS,
 TimeUnit.SECONDS)
           .removalListener((RemovalListener<String, ReceivingMailbox>) 
notification -> {
             if (notification.wasEvicted()) {
-              int numPendingBlocks = 
notification.getValue().getNumPendingBlocks();
+              ReceivingMailbox receivingMailbox = notification.getValue();
+              int numPendingBlocks = receivingMailbox.getNumPendingBlocks();
               if (numPendingBlocks > 0) {
                 LOGGER.warn("Evicting dangling receiving mailbox: {} with {} 
pending blocks", notification.getKey(),
                     numPendingBlocks);
               }
+              // In case there is a leak, we should cancel the mailbox to 
unblock any waiters and release resources.
+              receivingMailbox.cancel();

Review Comment:
   What could happen (especially when query is killed) is that receiver is 
never set up, and this mailbox will be dangling without a receiver pulling from 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to