From dcf3ee2781c52d5aa7cd0b8dae2b55b1b27fc109 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Wed, 31 May 2017 18:33:01 -0500 Subject: [PATCH] Fix sendPreparedQuery write error hang If the Write call in sendPreparedQuery encountered a non-fatal error - which means it sent no bytes. It still was marking the connection as not ready for query. That caused the next call to hang. --- conn.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/conn.go b/conn.go index be64f104..68312222 100644 --- a/conn.go +++ b/conn.go @@ -1039,12 +1039,15 @@ func (c *Conn) sendPreparedQuery(ps *PreparedStatement, arguments ...interface{} buf = appendSync(buf) n, err := c.conn.Write(buf) - if err != nil && fatalWriteErr(n, err) { - c.die(err) + if err != nil { + if fatalWriteErr(n, err) { + c.die(err) + } + return err } c.readyForQuery = false - return err + return nil } // fatalWriteError takes the response of a net.Conn.Write and determines if it is fatal