Skip to content

Commit

Permalink
fix reconnection issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sijms committed Mar 26, 2023
1 parent 923aa6c commit 66e43a6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions v2/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"reflect"
"regexp"
"strings"
"syscall"
)

type StmtType int
Expand Down Expand Up @@ -1735,7 +1736,7 @@ func (stmt *Stmt) _query() (driver.Rows, error) {
stmt.connection.session.ResetBuffer()
err = stmt.write()
if err != nil {
if errors.Is(err, io.EOF) {
if errors.Is(err, io.EOF) || errors.Is(err, syscall.EPIPE) {
tracer.Print("reconnect trial #", writeTrials+1)
stmt.connection.State = Closed
err = stmt.connection.Open()
Expand All @@ -1749,7 +1750,7 @@ func (stmt *Stmt) _query() (driver.Rows, error) {
dataSet = new(DataSet)
err = stmt.read(dataSet)
if err != nil {
if errors.Is(err, io.EOF) {
if errors.Is(err, io.EOF) || errors.Is(err, syscall.EPIPE) {
stmt.connection.connOption.Tracer.Print("reconnect trial #", writeTrials+1)
stmt.connection.State = Closed
err = stmt.connection.Open()
Expand Down

0 comments on commit 66e43a6

Please sign in to comment.