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
sometimes when developer forget to call SetConnMaxLifetime(sql api), or when developer use mysql with a proxy server, and the proxy server restart.
at these times, the connection is closed, the api return ErrInvalidConn. but this can not distinguish the error is connection is already closed , or other unexpect error。
so, when receive this error(ErrInvalidConn), developer can not decide appropriate retry is appropriate。
so, how about to return io.EOF when receive io.EOF . such as :
and return driver.ErrBadConn when read the packet length, such as:
if return driver.ErrBadConn, the go sql api will retry again to fix closed connection, this can work gracefull