diff --git a/protocol/dubbo/pool.go b/protocol/dubbo/pool.go index 546a5b335aee3e71a6e00e49888710edb20c694a..9beb221af9960e8da6a6f564ba80a1575275b8f1 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) }