title: CloudSQL ERROR 2013 from GCE instance
body: <p>From a GCE instance, I am executing the following from command line</p>
  
  <p>mysql -udbase -p -DmyDb -hmyIp  &lt; sql.txt </p>
  
  <p>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.</p>
  
  <p>After this last test, the processId changed from Query to sleep after 1172 seconds.</p>
  
  <p>However, the mysql command does not receive the response, it just stays there, as if still waiting for some response from CloudSql.</p>
  
  <p>After a minute or two, the processID disappears from the process list, and still the mysql command is there, as if waiting.</p>
  
  <p>After a very long period of time (between 30 and 60 minutes), I finally get:</p>
  
  <p>ERROR 2013 (HY000) at line 1: Lost connection to MySQL server during query</p>
  
  <p>It's like the connection between GCE and CloudSQL gets severed, just that the client does not realize it.</p>
  
  <p>As per recommendations in another post, I exaggerated the numbers in</p>
  
  <p>sudo /sbin/sysctl -w net.ipv4.tcp_keepalive_time=1800 net.ipv4.tcp_keepalive_intvl=1800 net.ipv4.tcp_keepalive_probes=50</p>
  
  <p>But the only thing this seemed to do, is prolong the time between when the query finishes and when the client finally disconnects.</p>
  
  <p>If net_read_timeout applied, shouldn't the client give the error much earlier?</p>
  
  <p>Thanks for your help.</p>