Connection problems and possible fix
juanjux opened this issue · comments
Juanjo Alvarez Martinez commented
From slack by @ajnavarro:
- Adding keepalive at the TCP level.
- Use NewListenerWithConfig and add a cfg.Listener that generates a Conn object we can handle.
net.Conn has two methods: https://golang.org/pkg/net/#TCPConn.SetKeepAlive and https://golang.org/pkg/net/#TCPConn.SetKeepAlivePeriod
Related: src-d/gitbase-spark-connector-enterprise#81
Juanjo Alvarez Martinez commented
I'll close this and open two new issues because the problem is two-fold:
- Connection timeouts from Vitess doesn't trigger, and thus stop the query, is a query is running but not sending anything.
- Closed connections, for other reasons than timeouts, for example a killed client, don't stop the query. In this case the connection should stop even if there isn't a timeout. The problem is that the socket is not checked until the timeout runs.