New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
database/sql: why not check connection timeout in putConn #27241
Comments
/cc @kardianos |
Drivers should implement ResetConnection, if only to check the connection status before use. I don't remember the reason off the top of my head. |
|
Looks like it is called ResetSession and is implemented here: https://github.com/go-sql-driver/mysql/blob/749ddf1598b47e3cd909414bda735fe790ef3d30/connection.go#L649 .
I'm not sure what you are trying to say here. Are you trying to avoid messages like "err: invalid connection"? Are you seeing this in your logs? |
|
You're chasing the wrong tree I think, if you are trying to get around Try to reproduce it locally in a test case. Try to adjust the sql.DB pool's settings, then try to adjust the MySQL server settings. It probably has to do with the connection string you are using would be my guess. |
ConnMaxLifetime and i/o timeout are totally unrelated. The connection returning i/o error is in bad state. We can not reuse the connection. I think this issue should be closed. |
What did you see instead?
In function
putConn
, there is no check driverConn timeout (which is set indb.SetConnMaxLifetime
)And in fuction
conn
there isconn.expired(lifetime)
What did you expect to see?
Why not check the connection timeout before put it into the idle connection pool?
Maybe it will be late to check it when we really get it from pool and return a driver.ErrBadConn.
The text was updated successfully, but these errors were encountered: