This is an automated email from the ASF dual-hosted git repository.

jinrongtong pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/rocketmq.git


The following commit(s) were added to refs/heads/develop by this push:
     new d254f791f2 [ISSUE #10071] Fix 
PopLiteLongPollingService#cleanUnusedResource
d254f791f2 is described below

commit d254f791f2cc3a61e12d1a4fa64caec282f1d92e
Author: Quan <[email protected]>
AuthorDate: Thu Feb 5 17:51:47 2026 +0800

    [ISSUE #10071] Fix PopLiteLongPollingService#cleanUnusedResource
    
    Problem: The cleanUnusedResource method was cleaning up client long polling 
requests without returning results to clients, causing client errors.
    
    Solution:
    1. Simplified the cleanUnusedResource method to only remove entries with 
empty request queues
    2. Changed cleanup interval from 5 minutes to 3 minutes
    
    Change-Id: If7052ba0d088e68cf654e6b7efafe09f5fa877be
---
 .../rocketmq/broker/longpolling/PopLiteLongPollingService.java   | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git 
a/broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java
 
b/broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java
index 246583c2ee..6983f99058 100644
--- 
a/broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java
+++ 
b/broker/src/main/java/org/apache/rocketmq/broker/longpolling/PopLiteLongPollingService.java
@@ -26,7 +26,6 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.rocketmq.broker.BrokerController;
 import org.apache.rocketmq.common.ServiceThread;
 import org.apache.rocketmq.common.constant.LoggerName;
-import org.apache.rocketmq.common.lite.LiteSubscription;
 import org.apache.rocketmq.logging.org.slf4j.Logger;
 import org.apache.rocketmq.logging.org.slf4j.LoggerFactory;
 import org.apache.rocketmq.remoting.netty.NettyRemotingAbstract;
@@ -126,7 +125,7 @@ public class PopLiteLongPollingService extends 
ServiceThread {
                 }
 
                 // clean unused
-                if (lastCleanTime == 0 || System.currentTimeMillis() - 
lastCleanTime > 5 * 60 * 1000) {
+                if (lastCleanTime == 0 || System.currentTimeMillis() - 
lastCleanTime > 3 * 60 * 1000) {
                     cleanUnusedResource();
                 }
             } catch (Throwable e) {
@@ -247,10 +246,8 @@ public class PopLiteLongPollingService extends 
ServiceThread {
     private void cleanUnusedResource() {
         try {
             pollingMap.entrySet().removeIf(entry -> {
-                String clientId = entry.getKey(); // see getPollingKey()
-                LiteSubscription subscription = 
brokerController.getLiteSubscriptionRegistry().getLiteSubscription(clientId);
-                if (null == subscription || 
CollectionUtils.isEmpty(subscription.getLiteTopicSet())) {
-                    LOGGER.info("clean polling structure of {}", clientId);
+                if (CollectionUtils.isEmpty(entry.getValue())) {
+                    LOGGER.info("clean polling structure of {}", 
entry.getKey()); // see getPollingKey()
                     return true;
                 }
                 return false;

Reply via email to