From 63393f1deb30144b83f9cb0442bdc98e546f90e4 Mon Sep 17 00:00:00 2001 From: pantianying <601666418@qq.com> Date: Fri, 30 Aug 2019 12:57:24 +0800 Subject: [PATCH 1/2] fix deadlock --- protocol/dubbo/pool.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/protocol/dubbo/pool.go b/protocol/dubbo/pool.go index 546a5b335a..9beb221af9 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 } @@ -290,12 +291,10 @@ func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPC continue } conn.created = now //update created time - - p.Unlock() return conn, nil } // create new conn - p.Unlock() + return newGettyRPCClientConn(p, protocol, addr) } From ad15595c3d1a8a6ae49078c07c6d6c447414fe58 Mon Sep 17 00:00:00 2001 From: pantianying <601666418@qq.com> Date: Fri, 30 Aug 2019 12:58:55 +0800 Subject: [PATCH 2/2] delete blank lines --- protocol/dubbo/pool.go | 1 - 1 file changed, 1 deletion(-) diff --git a/protocol/dubbo/pool.go b/protocol/dubbo/pool.go index 9beb221af9..ecd57e466a 100644 --- a/protocol/dubbo/pool.go +++ b/protocol/dubbo/pool.go @@ -294,7 +294,6 @@ func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPC return conn, nil } // create new conn - return newGettyRPCClientConn(p, protocol, addr) }