From 3bfc7d125dd662c0002b30dbee123c627660f975 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Mon, 3 Feb 2020 12:41:11 -0500 Subject: [PATCH] pool: Clear connection before releasing This to be consistent with other connection clean up handler as well as consul's https://github.com/hashicorp/consul/blob/v1.6.3/agent/pool/pool.go#L468-L479 . --- helper/pool/pool.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helper/pool/pool.go b/helper/pool/pool.go index abe1f574a..7b5d3b424 100644 --- a/helper/pool/pool.go +++ b/helper/pool/pool.go @@ -427,7 +427,6 @@ func (p *ConnPool) RPC(region string, addr net.Addr, version int, method string, err = msgpackrpc.CallWithCodec(sc.codec, method, args, reply) if err != nil { sc.Close() - p.releaseConn(conn) // If we read EOF, the session is toast. Clear it and open a // new session next time @@ -436,6 +435,8 @@ func (p *ConnPool) RPC(region string, addr net.Addr, version int, method string, p.clearConn(conn) } + p.releaseConn(conn) + // If the error is an RPC Coded error // return the coded error without wrapping if structs.IsErrRPCCoded(err) {