wangbo commented on code in PR #29739:
URL: https://github.com/apache/doris/pull/29739#discussion_r1446005128


##########
fe/fe-core/src/main/java/org/apache/doris/common/publish/TopicPublisherThread.java:
##########
@@ -103,16 +103,25 @@ public TopicPublishWorker(TPublishTopicRequest request, 
Backend node, ResponseHa
         @Override
         public void run() {
             long beginTime = System.currentTimeMillis();
+            BackendService.Client client = null;
+            TNetworkAddress address = null;
+            boolean ok = false;
             try {
-                TNetworkAddress addr = new TNetworkAddress(be.getHost(), 
be.getBePort());
-                BackendService.Client client = 
ClientPool.backendPool.borrowObject(addr);
+                address = new TNetworkAddress(be.getHost(), be.getBePort());
+                client = ClientPool.backendPool.borrowObject(address);
                 client.publishTopicInfo(request);
+                ok = true;
                 LOG.info("publish topic info to be {} success, time cost={} 
ms",
                         be.getHost(), (System.currentTimeMillis() - 
beginTime));
             } catch (Exception e) {
                 LOG.warn("publish topic info to be {} error happens: , time 
cost={} ms",
                         be.getHost(), (System.currentTimeMillis() - 
beginTime), e);
             } finally {
+                if (ok) {
+                    ClientPool.backendPool.returnObject(address, client);

Review Comment:
   We'd better catch a throwable exception for returnObject/invalidateObject



-- 
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-unsubscr...@doris.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to