diff --git a/protocol/dubbo/pool.go b/protocol/dubbo/pool.go index d619a2f8fe78524b3d704cb9de280ebbf534eb12..0c4e74ae71bdf953f2c8c957d0e66f2267115a25 100644 --- a/protocol/dubbo/pool.go +++ b/protocol/dubbo/pool.go @@ -291,8 +291,8 @@ func (p *gettyRPCClientPool) close() { func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPCClient, error) { p.Lock() - defer p.Unlock() if p.conns == nil { + p.Unlock() return nil, errClientPoolClosed } @@ -308,9 +308,10 @@ func (p *gettyRPCClientPool) getGettyRpcClient(protocol, addr string) (*gettyRPC continue } conn.updateActive(now) //update active time - + p.Unlock() return conn, nil } + p.Unlock() // create new conn return newGettyRPCClientConn(p, protocol, addr) }