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

alexstocks pushed a commit to branch 1.1
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/1.1 by this push:
     new 9ec37ad  Fix: gettyRPCClientPool.remove deadlock
9ec37ad is described below

commit 9ec37adffbdbd3a7093d2ee6a1d57df05bff9ab6
Author: AlexStocks <alexsto...@foxmail.com>
AuthorDate: Sat Aug 31 23:42:05 2019 +0800

    Fix: gettyRPCClientPool.remove deadlock
---
 protocol/dubbo/pool.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/protocol/dubbo/pool.go b/protocol/dubbo/pool.go
index 546a5b3..a8bb652 100644
--- a/protocol/dubbo/pool.go
+++ b/protocol/dubbo/pool.go
@@ -275,6 +275,7 @@ func (p *gettyRPCClientPool) close() {
 func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) 
(*gettyRPCClient, error) {
 
        p.Lock()
+       defer p.Unlock()
        if p.conns == nil {
                return nil, errClientPoolClosed
        }
@@ -291,11 +292,9 @@ func (p *gettyRPCClientPool) getGettyRpcClient(protocol, 
addr string) (*gettyRPC
                }
                conn.created = now //update created time
 
-               p.Unlock()
                return conn, nil
        }
        // create new conn
-       p.Unlock()
        return newGettyRPCClientConn(p, protocol, addr)
 }
 

Reply via email to