Skip to content

Commit

Permalink
Merge pull request #23 from dougsparling/master
Browse files Browse the repository at this point in the history
Avoid crash after synchronous query timeout
  • Loading branch information
benjaminballard authored Apr 3, 2018
2 parents 6c18361 + 1d6959b commit 93f7571
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions voltdbclient/node_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func (nc *nodeConn) loop(writer io.Writer, piCh <-chan *procedureInvocation, res
for _, req := range requests {
if time.Now().After(req.submitted.Add(req.timeout)) {
queuedBytes -= req.numBytes
nc.handleAsyncTimeout(req)
nc.handleTimeout(req)
delete(requests, req.handle)
}
}
Expand Down Expand Up @@ -348,10 +348,15 @@ func (nc *nodeConn) handleAsyncResponse(handle int64, r io.Reader, req *networkR
}
}

func (nc *nodeConn) handleAsyncTimeout(req *networkRequest) {
func (nc *nodeConn) handleTimeout(req *networkRequest) {
err := errors.New("timeout")
verr := VoltError{voltResponse: emptyVoltResponseInfo(), error: err}
req.arc.ConsumeError(verr)
if req.isSync() {
respCh := req.getChan()
respCh <- verr
} else {
req.arc.ConsumeError(verr)
}
}

func (nc *nodeConn) sendPing(writer io.Writer) {
Expand Down

0 comments on commit 93f7571

Please sign in to comment.