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
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: