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

Any keep alive mechanism built in? #371

Closed
elgs opened this issue Sep 17, 2015 · 3 comments
Closed

Any keep alive mechanism built in? #371

elgs opened this issue Sep 17, 2015 · 3 comments

Comments

@elgs
Copy link

elgs commented Sep 17, 2015

My Go app is a daemon service. Recently I found every morning the app is crashed. After some investigation, I found it was very likely the connections become zombies after a long time of idling. What I could do might be to start a go routine to touch the db with some dummy query every hour. Before doing that I was wondering whether the go-sql-driver/mysql library has any configuration for such keep alive problems? Thanks.

@methane
Copy link
Member

methane commented Sep 17, 2015

It may be relating to golang/go#9851

@arnehormann
Copy link
Member

It's next to impossible to handle this in the driver in a way that neither slows down others, nor causes problems in existing code or has high maintenance costs. That's why we don't have it.
Your best and simplest way to get around it is probably a dummy query from a goroutine with time.Tick.

@elgs
Copy link
Author

elgs commented Sep 17, 2015

Got it. That makes sense. Thank you.

@elgs elgs closed this as completed Sep 17, 2015
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

No branches or pull requests

3 participants