2

From a GCE instance, I am executing the following from command line

> mysql -udbase -p -DmyDb -hmyIp
> 
> mysql> SELECT account, count(account)
>     -> FROM `headers`
>     -> where labelIds='["SENT"]'
>     -> group by account order by 2 desc limit 0,50;

Once it gets running, I monitor the SQL command in another shell by checking the process list. I see the SQL, the processId and the time it is taking to execute.

After this last test, the processId changed from Query to sleep after 1172 seconds.

However, the mysql command does not receive the response, it just stays there, as if still waiting for some response from CloudSql.

After a minute or two, the processID disappears from the process list, and still the mysql command is there, as if waiting.

After a very long period of time (over 2 hours, left it overnight), I finally get:

ERROR 2013 (HY000) at line 1: Lost connection to MySQL server during query

It's like the connection between GCE and CloudSQL gets severed, just that the client does not realize it.

As per recommendations in another post, I exaggerated the numbers in

sudo /sbin/sysctl -w net.ipv4.tcp_keepalive_time=1800 net.ipv4.tcp_keepalive_intvl=1800 net.ipv4.tcp_keepalive_probes=50

But the only thing this seemed to do, is prolong the time between when the query finishes and when the client finally disconnects.

If net_read_timeout applied, shouldn't the client give the error much earlier?

Thanks for your help.

  • The sysctl command changes the default settings for TCP keepalive messages. But it won't cause TCP keepalive to be enabled for applications that haven't specifically requested it. Are you sure TCP keepalive is enabled on the client side of the connection? – kasperd Jul 29 '15 at 6:22
  • Your keepalive time and interval are probably too high. I would lower those values. Are there any middleboxes (such as NAT, firewall, or proxy) between client and server? – kasperd Jul 29 '15 at 6:32
2

I had missread the troubleshooting article https://cloud.google.com/compute/docs/troubleshooting#communicatewithinternet fixing all the parameters fixed it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.