-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix spurious errors when closing inactive connections #408
Conversation
When a connection is closed or reset before it is properly established, the existing ::getSession will log a spurious error since the connection has no attributes to extract for the pool type. Fix this by refactoring so that when closing a connection we only act on the session object if one already existed, i.e. the conn was used before.
func (ph *proxyHandler) closeSession(ctx context.Context, c *mysql.Conn) { | ||
session, _ := c.ClientData.(*vtgateconn.VTGateSession) | ||
if session == nil { | ||
return // no active session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously when this was in ::getSession, it would create the session, which would trigger the spurious error if the Conn had no attributes because it wasn't properly established in the first place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense and explains the behavior.
When a connection is closed or reset before it is properly established, the existing ::getSession will log a spurious error since the connection has no attributes to extract for the pool type. Fix this by refactoring so that when closing a connection we only act on the session object if one already existed, i.e. the conn was used before.
When a connection is closed or reset before it is properly established, the existing ::getSession will log a spurious error since the connection has no attributes to extract for the pool type. Fix this by refactoring so that when closing a connection we only act on the session object if one already existed, i.e. the conn was used before.
When a connection is closed or reset before it is properly established, the existing ::getSession will log a spurious error since the connection has no attributes to extract for the pool type. Fix this by refactoring so that when closing a connection we only act on the session object if one already existed, i.e. the conn was used before.
When a connection is closed or reset before it is properly established, the existing ::getSession will log a spurious error since the connection has no attributes to extract for the pool type. Fix this by refactoring so that when closing a connection we only act on the session object if one already existed, i.e. the conn was used before.
Description
When a connection is closed or reset before it is properly established, the existing ::getSession will log a spurious error since the connection has no attributes to extract for the pool type.
Fix this by refactoring so that when closing a connection we only act on the session object if one already existed, i.e. the conn was used before.
Related Issue(s)
Checklist
Deployment Notes