Skip to content
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

[HOTFIX] Set DB conn reuse timeout #261

Merged
merged 1 commit into from
Oct 5, 2018

Conversation

carlosms
Copy link
Contributor

@carlosms carlosms commented Oct 5, 2018

After an idle time of >60s the next query was always failing with Query Failed - invalid connection.
Apparently the problem is that the connection was close on gitbase's end and we still kept it open on our side.

More context in this thread:
go-sql-driver/mysql#674 (comment)

@carlosms carlosms requested a review from smola October 5, 2018 12:31
@smola smola requested a review from ajnavarro October 5, 2018 12:36
Copy link

@smola smola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding @ajnavarro, since he or someone else at data retrieval should not better than me.

@ajnavarro
Copy link

ajnavarro commented Oct 5, 2018

I think this will not solve the issue. The connection will expire one minute after it was first created, I guess causing the same error.

@carlosms
Copy link
Contributor Author

carlosms commented Oct 5, 2018

So, if I understand your comment, gitbase expires connections after one minute from creation, not one minute of inactivity?

@ajnavarro
Copy link

@carlosms ,no that is what is doing SetConnMaxLifetime method

@ajnavarro
Copy link

I think the correct fix should test the connection before use it. See: https://golang.org/pkg/database/sql/#Conn.PingContext

@carlosms
Copy link
Contributor Author

carlosms commented Oct 5, 2018

Push forced a new commit to set max idle connections to 0.

Signed-off-by: Carlos Martín <carlos.martin.sanchez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants