You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.