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.