Skip to content

Commit

Permalink
Fix: close conn on read failure in pipeline
Browse files Browse the repository at this point in the history
Suggested by @jameshartig in #1847
  • Loading branch information
jackc committed Dec 23, 2023
1 parent 4c14caa commit cbc5a70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pgconn/pgconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit cbc5a70

Please sign in to comment.