Skip to content

Commit

Permalink
Merge pull request #183 from pantianying/fix_deadlock
Browse files Browse the repository at this point in the history
Fix: gettyRPCClientPool.remove deadlock
  • Loading branch information
AlexStocks authored Aug 31, 2019
2 parents b38db96 + ad15595 commit a8cb98e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions protocol/dubbo/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -290,12 +291,9 @@ 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)
}

Expand Down

0 comments on commit a8cb98e

Please sign in to comment.