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

lizhanhui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git


The following commit(s) were added to refs/heads/master by this push:
     new e2c0b97a Golang: fix goroutine leak issue (#613)
e2c0b97a is described below

commit e2c0b97aed7aa17b6c9cef8fd86f1d70faa2ba19
Author: ainokiseki <43086824+ainokis...@users.noreply.github.com>
AuthorDate: Mon Nov 27 10:21:23 2023 +0800

    Golang: fix goroutine leak issue (#613)
    
    * fix goroutine leak
    
    * test version
    
    * Revert "test version"
    
    This reverts commit 23da93ce6e7d01ab15884edbb2b8a80a5e7e46a9.
    
    * fix: correct spell errors
    
    Signed-off-by: Li Zhanhui <lizhan...@gmail.com>
    
    ---------
    
    Signed-off-by: Li Zhanhui <lizhan...@gmail.com>
    Co-authored-by: bo.jiang03 <bo.jian...@mihoyo.com>
    Co-authored-by: Li Zhanhui <lizhan...@gmail.com>
---
 golang/client.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/golang/client.go b/golang/client.go
index 0a7defaa..45e4b549 100644
--- a/golang/client.go
+++ b/golang/client.go
@@ -102,6 +102,11 @@ func (cs *defaultClientSession) startUp() {
        cs.cli.log.Infof("defaultClientSession is startUp! endpoints=%v", 
cs.endpoints)
        go func() {
                for {
+                       select {
+                       case <-cs.cli.done:
+                               return
+                       default:
+                       }
                        // ensure that observer is present, if not wait for it 
to be regenerated on publish.
                        observer, acquired_observer := cs._acquire_observer()
                        if !acquired_observer {

Reply via email to