Fix: close conn on read failure in pipeline

Suggested by @jameshartig in https://github.com/jackc/pgx/issues/1847
pull/1856/head
Jack Christensen 2023-12-23 12:11:23 -06:00
parent 4c14caae07
commit cbc5a7055f
1 changed files with 2 additions and 1 deletions

View File

@ -2117,7 +2117,8 @@ func (p *Pipeline) getResults() (results any, err error) {
case *pgproto3.ParseComplete:
peekedMsg, err := p.conn.peekMessage()
if err != nil {
return nil, err
p.conn.asyncClose()
return nil, normalizeTimeoutError(p.ctx, err)
}
if _, ok := peekedMsg.(*pgproto3.ParameterDescription); ok {
return p.getResultsPrepare()