Closed
Description
ErrBadConn
can be returned only when it's safe to retry. After sending query, we can't use it.
People must use DB.SetConnMaxLifetime
to avoid connection closed from MySQL server, router, middlewares, to avoid such situation.
But we can save 90% cases by checking connection liveness before sending query.
Since Go 1.9, SyscallConn can be used to call system call directly. We can try non-blocking 1-byte read to detect connection closed by peer.
Ref: #657
Ref: golang/go#28607
Metadata
Metadata
Assignees
Labels
No labels