src-d / go-mysql-server

An extensible MySQL server implementation in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connection problems and possible fix

juanjux opened this issue · comments

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

I'll close this and open two new issues because the problem is two-fold:

  1. Connection timeouts from Vitess doesn't trigger, and thus stop the query, is a query is running but not sending anything.

#799

  1. 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.

#800