Skip to content

Enable retry on unexpected EOF via retry.TransientErr

Latest
Compare
Choose a tag to compare
@vcschapp vcschapp released this 13 Dec 00:39

tl;dr If you use retry.TransientErr in a retry policy, then unexpected end-of-file errors will be treated as transient errors and retried.

  • Added new transient error category transient.UnexpectedEOF.
  • Classify io.EOF and io.ErrUnexpectedEOF as transient.UnexpectedEOF with the following effects for the retry decider retry.TransientErr:
    • If the underlying Doer.Do(...) method fails as a result of an io.EOF, for example if a remote load balancer decides to throttle a TLS handshake by FIN-ning the connection, retry.TransientErr will indicate a retry.
    • If the response body read fails with an io.ErrUnexpectedEOF because the remote host closed the connection before all bytes indicated by the Content-Length response header have been received, retry.TransientErr will indicate a retry.
  • (minor) Improve some stale panic messages.
  • (minor) Improve some documentation.