crazywen opened a new issue, #8875:
URL: https://github.com/apache/rocketmq/issues/8875

   ### Before Creating the Bug Report
   
   - [X] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq/discussions).
   
   - [X] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq/discussions)  of this 
repository and believe that this is not a duplicate.
   
   - [X] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   
   ### Runtime platform environment
   
   CentOS Linux 7 (Core)
   
   ### RocketMQ version
   
   rocketmq-all-5.1.4
   
   ### JDK Version
   
   java version "1.8.0_251"
   Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
   Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)
   
   
   ### Describe the Bug
   
   在生产场景中,发现了堆内存溢出,业务量并不大。
   
![image](https://github.com/user-attachments/assets/db5a0cfd-8dc5-4d14-aeb7-5cd7e85dc1c1)
   
   
   ### Steps to Reproduce
   
   针对ha端口10912进行高频探活,压测时间一长即可出现。
   `
   # -*- coding:UTF-8 -*-
   import sys
   import socket
   import time
   sys.path.append(".")
   def tcp_health_check(host, port):
       now = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
       try:
           sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
           sock.settimeout(1)
           sock.connect((host, port))
           sock.sendall(now.encode())
           print("{}TCP连接成功:{}:{}".format(now,host,port))
           sock.close()
           return True
       except socket.error as e:
           print("TCP连接失败: {}".format(e))
           if sock:
               sock.close()
           return False
   
   
   def main():
       host = '127.0.0.1'  
       port = 8081  
   
       while True:
           result = tcp_health_check('127.0.0.1' , 10912)
           time.sleep(0.5)
   
   
   if __name__ == "__main__":
       main()
   `
   
   ### What Did You Expect to See?
   
   探活不应该造成broker内存溢出
   
   ### What Did You See Instead?
   
   
应该针对这种异常场景进行风险规避,通过堆栈和ha逻辑确认,在haconnection建立,进行Read/WriteSocketService线程的启动,和追加connection到列表的顺序里面,存在先删(Read/WriteSocketService
 run方法执行),后追加的风险。
   
   ### Additional Context
   
   
![企业微信截图_1730255620288](https://github.com/user-attachments/assets/2206325c-4531-49c7-952d-5eca419172a9)
   
![企业微信截图_17302556638843](https://github.com/user-attachments/assets/60fd802c-cb09-4df9-89a4-994b15558f27)
   


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

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

Reply via email to